9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-28 11:19:19 +00:00
Files
DivineMC/patches/server/0035-Improve-biome-temperature-cache.patch
2024-04-16 01:19:40 +03:00

29 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sun, 14 Jan 2024 22:54:49 +0300
Subject: [PATCH] Improve biome temperature 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 57f3193ff761cbe45846a02a15d8da9c9e2e87ee..93a7647b19315aa4dc2f0a236fac330de4bed813 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<gg.airplane.structs.Long2FloatAgingCache> temperatureCache = ThreadLocal.withInitial(() -> Util.make(() -> {
+ private static final ThreadLocal<gg.airplane.structs.Long2FloatAgingCache> temperatureCache = ThreadLocal.withInitial(() -> Util.make(() -> {
/*
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(); // DivineMC - Improve biome temperature cache
float f = cache.getValue(l);
if (!Float.isNaN(f)) {
return f;