diff --git a/common/src/main/java/xaeroplus/Globals.java b/common/src/main/java/xaeroplus/Globals.java index ba5ca3ea..09622657 100644 --- a/common/src/main/java/xaeroplus/Globals.java +++ b/common/src/main/java/xaeroplus/Globals.java @@ -22,7 +22,7 @@ * static variables and functions to share or persist across mixins */ public class Globals { - public static final DrawManager DRAW_MANAGER = new DrawManager(); + public static final DrawManager drawManager = new DrawManager(); // cache and only update this on new world loads public static boolean nullOverworldDimensionFolder = false; public static Settings.DataFolderResolutionMode dataFolderResolutionMode = Settings.DataFolderResolutionMode.IP; diff --git a/common/src/main/java/xaeroplus/feature/render/LineDrawFeature.java b/common/src/main/java/xaeroplus/feature/render/LineDrawFeature.java index ea77b0e5..2223f885 100644 --- a/common/src/main/java/xaeroplus/feature/render/LineDrawFeature.java +++ b/common/src/main/java/xaeroplus/feature/render/LineDrawFeature.java @@ -2,6 +2,7 @@ import com.github.benmanes.caffeine.cache.AsyncLoadingCache; import com.github.benmanes.caffeine.cache.Caffeine; +import net.minecraft.client.Minecraft; import xaeroplus.Globals; import xaeroplus.util.ChunkUtils; @@ -20,7 +21,7 @@ public LineDrawFeature(LineProvider lineProvider, int refreshIntervalMs) { this.lineRenderCache = Caffeine.newBuilder() .expireAfterWrite(10, TimeUnit.SECONDS) .refreshAfterWrite(refreshIntervalMs, TimeUnit.MILLISECONDS) - .executor(Globals.cacheRefreshExecutorService.get()) + .executor(Minecraft.getInstance()) .buildAsync(k -> loadLinesInWindow()); } @@ -53,6 +54,6 @@ public void invalidateCache() { } public List getLines() { - return lineRenderCache.get(0L).getNow(Collections.EMPTY_LIST); + return lineRenderCache.get(0L).getNow(Collections.emptyList()); } } diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinGuiMap.java b/common/src/main/java/xaeroplus/mixin/client/MixinGuiMap.java index 918e4f07..2d8fe7ef 100644 --- a/common/src/main/java/xaeroplus/mixin/client/MixinGuiMap.java +++ b/common/src/main/java/xaeroplus/mixin/client/MixinGuiMap.java @@ -239,7 +239,7 @@ public void drawWorldMapFeatures(final GuiGraphics guiGraphics, final int scaled @Local(name = "renderTypeBuffers") MultiBufferSource.BufferSource renderTypeBuffers, @Local(name = "fboScale") double fboScale) { if (Minecraft.getInstance().options.hideGui) return; - Globals.DRAW_MANAGER.drawWorldMapFeatures( + Globals.drawManager.drawWorldMapFeatures( flooredCameraX, flooredCameraZ, matrixStack, diff --git a/common/src/main/java/xaeroplus/mixin/client/MixinMinimapFBORenderer.java b/common/src/main/java/xaeroplus/mixin/client/MixinMinimapFBORenderer.java index f0aa5667..0b3abb6d 100644 --- a/common/src/main/java/xaeroplus/mixin/client/MixinMinimapFBORenderer.java +++ b/common/src/main/java/xaeroplus/mixin/client/MixinMinimapFBORenderer.java @@ -197,7 +197,7 @@ public void drawMinimapFeatures(final SupportXaeroWorldmap instance, final Minim int insideX = xFloored & 15; int insideZ = zFloored & 15; MinimapShaders.FRAMEBUFFER_LINES.setFrameSize((float)this.scalingFramebuffer.viewWidth, (float)this.scalingFramebuffer.viewHeight); - Globals.DRAW_MANAGER.drawMinimapFeatures( + Globals.drawManager.drawMinimapFeatures( chunkX, chunkZ, tileX, @@ -228,7 +228,7 @@ public void drawMinimapFeaturesCaveMode(final MultiTextureRenderTypeRendererProv int tileZ = mapZ & 3; int insideX = xFloored & 15; int insideZ = zFloored & 15; - Globals.DRAW_MANAGER.drawMinimapFeatures( + Globals.drawManager.drawMinimapFeatures( chunkX, chunkZ, tileX, tileZ, insideX, insideZ, diff --git a/common/src/main/java/xaeroplus/module/impl/Highways.java b/common/src/main/java/xaeroplus/module/impl/Highways.java index 97472144..813e9094 100644 --- a/common/src/main/java/xaeroplus/module/impl/Highways.java +++ b/common/src/main/java/xaeroplus/module/impl/Highways.java @@ -74,7 +74,7 @@ public class Highways extends Module { @Override public void onEnable() { - Globals.DRAW_MANAGER.registry().registerLineProvider( + Globals.drawManager.registry().registerLineProvider( this.getClass().getName(), this::getHighwayLines, this::getHighwayColor, @@ -145,7 +145,7 @@ private List generateHighwayLines(ResourceKey dimension) { @Override public void onDisable() { - Globals.DRAW_MANAGER.registry().unregisterLineProvider(this.getClass().getName()); + Globals.drawManager.registry().unregisterLineProvider(this.getClass().getName()); } public int getHighwayColor() { diff --git a/common/src/main/java/xaeroplus/module/impl/LiquidNewChunks.java b/common/src/main/java/xaeroplus/module/impl/LiquidNewChunks.java index acb9aed1..1d005390 100644 --- a/common/src/main/java/xaeroplus/module/impl/LiquidNewChunks.java +++ b/common/src/main/java/xaeroplus/module/impl/LiquidNewChunks.java @@ -148,13 +148,13 @@ public synchronized void setInverseRenderEnabled(final boolean b) { if (this.renderInverse && this.isEnabled()) { registerInverseChunkHighlightProvider(); } else { - Globals.DRAW_MANAGER.registry().unregisterChunkHighlightProvider(inverseDrawFeatureId); + Globals.drawManager.registry().unregisterChunkHighlightProvider(inverseDrawFeatureId); } } @Override public void onEnable() { - Globals.DRAW_MANAGER.registry().registerDirectChunkHighlightProvider( + Globals.drawManager.registry().registerDirectChunkHighlightProvider( this.getClass().getName(), this::getNewChunkHighlightsState, this::getNewChunksColor); @@ -166,7 +166,7 @@ public void onEnable() { } private void registerInverseChunkHighlightProvider() { - Globals.DRAW_MANAGER.registry().registerDirectChunkHighlightProvider( + Globals.drawManager.registry().registerDirectChunkHighlightProvider( inverseDrawFeatureId, this::getInverseNewChunkHighlightsState, this::getInverseColor); @@ -176,8 +176,8 @@ private void registerInverseChunkHighlightProvider() { public void onDisable() { newChunksCache.onDisable(); inverseNewChunksCache.onDisable(); - Globals.DRAW_MANAGER.registry().unregisterChunkHighlightProvider(this.getClass().getName()); - Globals.DRAW_MANAGER.registry().unregisterChunkHighlightProvider(inverseDrawFeatureId); + Globals.drawManager.registry().unregisterChunkHighlightProvider(this.getClass().getName()); + Globals.drawManager.registry().unregisterChunkHighlightProvider(inverseDrawFeatureId); } public int getNewChunksColor() { diff --git a/common/src/main/java/xaeroplus/module/impl/OldBiomes.java b/common/src/main/java/xaeroplus/module/impl/OldBiomes.java index 6c60bdfe..13b69813 100644 --- a/common/src/main/java/xaeroplus/module/impl/OldBiomes.java +++ b/common/src/main/java/xaeroplus/module/impl/OldBiomes.java @@ -37,7 +37,7 @@ public class OldBiomes extends Module { @Override public void onEnable() { - Globals.DRAW_MANAGER.registry().registerDirectChunkHighlightProvider( + Globals.drawManager.registry().registerDirectChunkHighlightProvider( this.getClass().getName(), this::getHighlightsState, this::getOldBiomesColor); @@ -52,7 +52,7 @@ public void onEnable() { @Override public void onDisable() { oldBiomesCache.onDisable(); - Globals.DRAW_MANAGER.registry().unregisterChunkHighlightProvider(this.getClass().getName()); + Globals.drawManager.registry().unregisterChunkHighlightProvider(this.getClass().getName()); } @EventHandler diff --git a/common/src/main/java/xaeroplus/module/impl/OldChunks.java b/common/src/main/java/xaeroplus/module/impl/OldChunks.java index d1977e7a..ef2fecf3 100644 --- a/common/src/main/java/xaeroplus/module/impl/OldChunks.java +++ b/common/src/main/java/xaeroplus/module/impl/OldChunks.java @@ -96,7 +96,7 @@ public boolean inUnknownDimension() { @Override public void onEnable() { - Globals.DRAW_MANAGER.registry().registerDirectChunkHighlightProvider( + Globals.drawManager.registry().registerDirectChunkHighlightProvider( this.getClass().getName(), this::getHighlightsState, this::getOldChunksColor); @@ -125,7 +125,7 @@ private void searchAllLoadedChunks() { public void onDisable() { oldChunksCache.onDisable(); modernChunksCache.onDisable(); - Globals.DRAW_MANAGER.registry().unregisterChunkHighlightProvider(this.getClass().getName()); + Globals.drawManager.registry().unregisterChunkHighlightProvider(this.getClass().getName()); } public int getOldChunksColor() { diff --git a/common/src/main/java/xaeroplus/module/impl/PaletteNewChunks.java b/common/src/main/java/xaeroplus/module/impl/PaletteNewChunks.java index a5c0b1ce..9fb94b8f 100644 --- a/common/src/main/java/xaeroplus/module/impl/PaletteNewChunks.java +++ b/common/src/main/java/xaeroplus/module/impl/PaletteNewChunks.java @@ -178,7 +178,7 @@ private static boolean isPlainsBiome(Holder holder) { @Override public void onEnable() { - Globals.DRAW_MANAGER.registry().registerDirectChunkHighlightProvider( + Globals.drawManager.registry().registerDirectChunkHighlightProvider( this.getClass().getName(), this::getHighlightsState, this::getNewChunksColor); @@ -190,7 +190,7 @@ public void onEnable() { public void onDisable() { newChunksCache.onDisable(); newChunksInverseCache.onDisable(); - Globals.DRAW_MANAGER.registry().unregisterChunkHighlightProvider(this.getClass().getName()); + Globals.drawManager.registry().unregisterChunkHighlightProvider(this.getClass().getName()); } public int getNewChunksColor() { diff --git a/common/src/main/java/xaeroplus/module/impl/PortalSkipDetection.java b/common/src/main/java/xaeroplus/module/impl/PortalSkipDetection.java index 201fd446..9f761d48 100644 --- a/common/src/main/java/xaeroplus/module/impl/PortalSkipDetection.java +++ b/common/src/main/java/xaeroplus/module/impl/PortalSkipDetection.java @@ -77,7 +77,7 @@ public void onXaeroWorldChangeEvent(final XaeroWorldChangeEvent event) { @Override public void onEnable() { - Globals.DRAW_MANAGER.registry().registerDirectChunkHighlightProvider( + Globals.drawManager.registry().registerDirectChunkHighlightProvider( this.getClass().getName(), this::getHighlightsState, this::getPortalSkipChunksColor); @@ -90,7 +90,7 @@ public void onEnable() { @Override public void onDisable() { reset(); - Globals.DRAW_MANAGER.registry().unregisterChunkHighlightProvider(this.getClass().getName()); + Globals.drawManager.registry().unregisterChunkHighlightProvider(this.getClass().getName()); } private void initializeWorld() { diff --git a/common/src/main/java/xaeroplus/module/impl/Portals.java b/common/src/main/java/xaeroplus/module/impl/Portals.java index 5b750221..056ea716 100644 --- a/common/src/main/java/xaeroplus/module/impl/Portals.java +++ b/common/src/main/java/xaeroplus/module/impl/Portals.java @@ -44,7 +44,7 @@ public void setDiskCache(final boolean disk) { @Override public void onEnable() { - Globals.DRAW_MANAGER.registry().registerDirectChunkHighlightProvider( + Globals.drawManager.registry().registerDirectChunkHighlightProvider( this.getClass().getName(), this::getHighlightsState, this::getPortalsColor); @@ -55,7 +55,7 @@ public void onEnable() { @Override public void onDisable() { portalsCache.onDisable(); - Globals.DRAW_MANAGER.registry().unregisterChunkHighlightProvider(this.getClass().getName()); + Globals.drawManager.registry().unregisterChunkHighlightProvider(this.getClass().getName()); } @EventHandler diff --git a/common/src/main/java/xaeroplus/module/impl/RenderDistance.java b/common/src/main/java/xaeroplus/module/impl/RenderDistance.java index 179a3f6a..201e06be 100644 --- a/common/src/main/java/xaeroplus/module/impl/RenderDistance.java +++ b/common/src/main/java/xaeroplus/module/impl/RenderDistance.java @@ -21,7 +21,7 @@ public class RenderDistance extends Module { @Override public void onEnable() { - Globals.DRAW_MANAGER.registry().registerLineProvider( + Globals.drawManager.registry().registerLineProvider( this.getClass().getName(), this::getLines, this::getColor, @@ -32,7 +32,7 @@ public void onEnable() { @Override public void onDisable() { - Globals.DRAW_MANAGER.registry().unregisterLineProvider(this.getClass().getName()); + Globals.drawManager.registry().unregisterLineProvider(this.getClass().getName()); } List getLines(final int windowRegionX, final int windowRegionZ, final int windowRegionSize, final ResourceKey dimension) { diff --git a/common/src/main/java/xaeroplus/module/impl/WorldBorder.java b/common/src/main/java/xaeroplus/module/impl/WorldBorder.java index 3a20e07f..e504598e 100644 --- a/common/src/main/java/xaeroplus/module/impl/WorldBorder.java +++ b/common/src/main/java/xaeroplus/module/impl/WorldBorder.java @@ -17,7 +17,7 @@ public class WorldBorder extends Module { @Override public void onEnable() { - Globals.DRAW_MANAGER.registry().registerLineProvider( + Globals.drawManager.registry().registerLineProvider( this.getClass().getName(), this::getLines, this::getColor, @@ -28,7 +28,7 @@ public void onEnable() { @Override public void onDisable() { - Globals.DRAW_MANAGER.registry().unregisterLineProvider(this.getClass().getName()); + Globals.drawManager.registry().unregisterLineProvider(this.getClass().getName()); } List getLines(final int windowRegionX, final int windowRegionZ, final int windowRegionSize, final ResourceKey dimension) { diff --git a/common/src/main/java/xaeroplus/module/impl/WorldTools.java b/common/src/main/java/xaeroplus/module/impl/WorldTools.java index 5140a1c9..799827a3 100644 --- a/common/src/main/java/xaeroplus/module/impl/WorldTools.java +++ b/common/src/main/java/xaeroplus/module/impl/WorldTools.java @@ -20,7 +20,7 @@ public class WorldTools extends Module { @Override public void onEnable() { if (!WorldToolsHelper.isWorldToolsPresent()) return; - Globals.DRAW_MANAGER.registry().registerAsyncChunkHighlightProvider( + Globals.drawManager.registry().registerAsyncChunkHighlightProvider( this.getClass().getName(), this::getWindowedHighlightsSnapshot, this::getWorldToolsColor @@ -29,7 +29,7 @@ public void onEnable() { @Override public void onDisable() { - Globals.DRAW_MANAGER.registry().unregisterChunkHighlightProvider(this.getClass().getName()); + Globals.drawManager.registry().unregisterChunkHighlightProvider(this.getClass().getName()); } public boolean isChunkDownloaded(final int x, final int z, final ResourceKey dimension) {