From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: AlphaKR93 Date: Sat, 27 Apr 2024 14:14:49 +0900 Subject: [PATCH] Improve biome temperture cache diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java index 0c317b0147a73a8075e0883f0c132f4db0bdfea7..97c5cc3e2e6721321d9c500e331cab1aee37a0fc 100644 --- a/src/main/java/net/minecraft/world/level/biome/Biome.java +++ b/src/main/java/net/minecraft/world/level/biome/Biome.java @@ -64,7 +64,7 @@ public final class Biome { private final MobSpawnSettings mobSettings; private final BiomeSpecialEffects specialEffects; // Pufferfish start - use our cache - private final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> Util.make(() -> { + private static final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> Util.make(() -> { // Plazma - Improve biome temperature cache /* Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = new Long2FloatLinkedOpenHashMap(1024, 0.25F) { protected void rehash(int i) { @@ -118,7 +118,7 @@ public final class Biome { public float getTemperature(BlockPos blockPos) { long l = blockPos.asLong(); // Pufferfish start - gg.airplane.structs.Long2FloatAgingCache cache = this.temperatureCache.get(); + gg.airplane.structs.Long2FloatAgingCache cache = temperatureCache.get(); // Plazma - Improve biome temperature cache float f = cache.getValue(l); if (!Float.isNaN(f)) { return f;