Skip to content

Commit

Permalink
Merge branch '1.20.4' into 1.20.6
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Feb 3, 2025
2 parents 25da7ba + d1b061a commit 75c6204
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion common/src/main/java/xaeroplus/Globals.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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());
}

Expand Down Expand Up @@ -53,6 +54,6 @@ public void invalidateCache() {
}

public List<Line> getLines() {
return lineRenderCache.get(0L).getNow(Collections.EMPTY_LIST);
return lineRenderCache.get(0L).getNow(Collections.emptyList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/xaeroplus/module/impl/Highways.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -145,7 +145,7 @@ private List<Line> generateHighwayLines(ResourceKey<Level> dimension) {

@Override
public void onDisable() {
Globals.DRAW_MANAGER.registry().unregisterLineProvider(this.getClass().getName());
Globals.drawManager.registry().unregisterLineProvider(this.getClass().getName());
}

public int getHighwayColor() {
Expand Down
10 changes: 5 additions & 5 deletions common/src/main/java/xaeroplus/module/impl/LiquidNewChunks.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -166,7 +166,7 @@ public void onEnable() {
}

private void registerInverseChunkHighlightProvider() {
Globals.DRAW_MANAGER.registry().registerDirectChunkHighlightProvider(
Globals.drawManager.registry().registerDirectChunkHighlightProvider(
inverseDrawFeatureId,
this::getInverseNewChunkHighlightsState,
this::getInverseColor);
Expand All @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/xaeroplus/module/impl/OldBiomes.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/xaeroplus/module/impl/OldChunks.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private static boolean isPlainsBiome(Holder<Biome> holder) {

@Override
public void onEnable() {
Globals.DRAW_MANAGER.registry().registerDirectChunkHighlightProvider(
Globals.drawManager.registry().registerDirectChunkHighlightProvider(
this.getClass().getName(),
this::getHighlightsState,
this::getNewChunksColor);
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/xaeroplus/module/impl/Portals.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<Line> getLines(final int windowRegionX, final int windowRegionZ, final int windowRegionSize, final ResourceKey<Level> dimension) {
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/xaeroplus/module/impl/WorldBorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<Line> getLines(final int windowRegionX, final int windowRegionZ, final int windowRegionSize, final ResourceKey<Level> dimension) {
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/xaeroplus/module/impl/WorldTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Level> dimension) {
Expand Down

0 comments on commit 75c6204

Please sign in to comment.