From 6a418de153a2a8e7fd9023ac9a1d65f9bd2a8e01 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 29 Oct 2025 21:38:57 -0500 Subject: [PATCH] minor AbstractDhTintGetter optimization --- .../common/wrappers/block/AbstractDhTintGetter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/AbstractDhTintGetter.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/AbstractDhTintGetter.java index aaddc1ec3..75c863235 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/AbstractDhTintGetter.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/block/AbstractDhTintGetter.java @@ -39,7 +39,7 @@ public abstract class AbstractDhTintGetter implements BlockAndTintGetter private static final ConcurrentHashMap> BIOME_BY_RESOURCE_STRING = new ConcurrentHashMap<>(); #endif - private static final ConcurrentHashMap COLOR_BY_BIOME = new ConcurrentHashMap<>(); + private static final ConcurrentHashMap COLOR_BY_BIOME_WRAPPER = new ConcurrentHashMap<>(); /** returned if the color cache is incomplete */ public static final int INVALID_COLOR = Integer.MIN_VALUE; @@ -185,7 +185,7 @@ public abstract class AbstractDhTintGetter implements BlockAndTintGetter private int tryGetClientBiomeColor(@Nullable ColorResolver colorResolver, BiomeWrapper biomeWrapper) { // use the cached color if possible - int cachedColor = COLOR_BY_BIOME.getOrDefault(unwrapClientBiome(biomeWrapper), INVALID_COLOR); + int cachedColor = COLOR_BY_BIOME_WRAPPER.getOrDefault(biomeWrapper, INVALID_COLOR); if (cachedColor != INVALID_COLOR) { return cachedColor; @@ -199,9 +199,9 @@ public abstract class AbstractDhTintGetter implements BlockAndTintGetter return INVALID_COLOR; } - return COLOR_BY_BIOME.computeIfAbsent(unwrapClientBiome(biomeWrapper), + return COLOR_BY_BIOME_WRAPPER.computeIfAbsent(biomeWrapper, // in James' testing the block position isn't needed so we can just default to (0,0) - (unwrappedBiome) -> colorResolver.getColor(unwrappedBiome, 0, 0)); + (newBiomeWrapper) -> colorResolver.getColor(unwrapClientBiome(biomeWrapper), 0, 0)); } protected static Biome unwrapClientBiome(BiomeWrapper biomeWrapper)