aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0458-Significantly-improve-performance-of-the-end-generat.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0458-Significantly-improve-performance-of-the-end-generat.patch')
-rw-r--r--patches/server/0458-Significantly-improve-performance-of-the-end-generat.patch12
1 files changed, 6 insertions, 6 deletions
diff --git a/patches/server/0458-Significantly-improve-performance-of-the-end-generat.patch b/patches/server/0458-Significantly-improve-performance-of-the-end-generat.patch
index ddb86100e5..3ddbe5452e 100644
--- a/patches/server/0458-Significantly-improve-performance-of-the-end-generat.patch
+++ b/patches/server/0458-Significantly-improve-performance-of-the-end-generat.patch
@@ -12,7 +12,7 @@ Co-authored-by: Dylan Xaldin <[email protected]>
Co-authored-by: pop4959 <[email protected]>
diff --git a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
-index 92c2df6a6abd9c60e90b0b84ab66987557adb9c8..d5dccab8020e31f818420b8ee59c6d3928f1dfff 100644
+index 2cf20ef14ad18346f942395546ad31f2d774f81a..ed8cfa36f41643b191714b2ae6176f58f93bd4b2 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
@@ -509,6 +509,16 @@ public final class DensityFunctions {
@@ -39,9 +39,9 @@ index 92c2df6a6abd9c60e90b0b84ab66987557adb9c8..d5dccab8020e31f818420b8ee59c6d39
+ NoiseCache cache = noiseCache.get().computeIfAbsent(sampler, noiseKey -> new NoiseCache()); // Paper - Perf: Optimize end generation
for (int m = -12; m <= 12; m++) {
for (int n = -12; n <= 12; n++) {
- long o = (long)(i + m);
- long p = (long)(j + n);
-- if (o * o + p * p > 4096L && sampler.getValue((double)o, (double)p) < -0.9F) {
+ long o = i + m;
+ long p = j + n;
+- if (o * o + p * p > 4096L && sampler.getValue(o, p) < -0.9F) {
- float g = (Mth.abs((float)o) * 3439.0F + Mth.abs((float)p) * 147.0F) % 13.0F + 9.0F;
+ // Paper start - Perf: Optimize end generation by using a noise cache
+ long key = net.minecraft.world.level.ChunkPos.asLong((int) o, (int) p);
@@ -58,6 +58,6 @@ index 92c2df6a6abd9c60e90b0b84ab66987557adb9c8..d5dccab8020e31f818420b8ee59c6d39
+ }
+ if (g != Float.MIN_VALUE) {
+ // Paper end - Perf: Optimize end generation
- float h = (float)(k - m * 2);
- float q = (float)(l - n * 2);
+ float h = k - m * 2;
+ float q = l - n * 2;
float r = 100.0F - Mth.sqrt(h * h + q * q) * g;