diff options
author | Nassim Jahnke <[email protected]> | 2024-12-19 11:01:00 +0100 |
---|---|---|
committer | Nassim Jahnke <[email protected]> | 2024-12-19 11:01:00 +0100 |
commit | 8f5d9953f517f29159b852d1299587d6acd59657 (patch) | |
tree | 4f0fafc42fb30e7434711c893829f2d09f67419c | |
parent | 15ad7cc156039cbcb2b3db0b861eb2d68c1e79a9 (diff) | |
download | Paper-8f5d9953f517f29159b852d1299587d6acd59657.tar.gz Paper-8f5d9953f517f29159b852d1299587d6acd59657.zip |
Fix DensityFunctions lvt
3 files changed, 21 insertions, 18 deletions
diff --git a/paper-server/patches/sources/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch b/paper-server/patches/sources/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch index b93d5faef8..c1082899a2 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch @@ -4,10 +4,10 @@ private static final int GATEWAY_DISTANCE = 96; public static final int DRAGON_SPAWN_Y = 128; private final Predicate<Entity> validPlayer; -+ private static final Component DEFAULT_BOSS_EVENT_NAME = Component.translatable("entity.minecraft.ender_dragon"); // Paper - ensure reset EnderDragon boss event name ++ private static final Component DEFAULT_BOSS_EVENT_NAME = Component.translatable("entity.minecraft.ender_dragon"); // Paper - reset EnderDragon boss event name public final ServerBossEvent dragonEvent = (ServerBossEvent)new ServerBossEvent( - Component.translatable("entity.minecraft.ender_dragon"), BossEvent.BossBarColor.PINK, BossEvent.BossBarOverlay.PROGRESS -+ DEFAULT_BOSS_EVENT_NAME, BossEvent.BossBarColor.PINK, BossEvent.BossBarOverlay.PROGRESS // Paper ++ DEFAULT_BOSS_EVENT_NAME, BossEvent.BossBarColor.PINK, BossEvent.BossBarOverlay.PROGRESS // Paper - reset EnderDragon boss event name ) .setPlayBossMusic(true) .setCreateWorldFog(true); diff --git a/paper-server/patches/sources/net/minecraft/world/level/entity/EntityLookup.java.patch b/paper-server/patches/sources/net/minecraft/world/level/entity/EntityLookup.java.patch index 900da01b8e..27c389bc82 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/entity/EntityLookup.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/entity/EntityLookup.java.patch @@ -11,7 +11,7 @@ + LOGGER.error("Overwrote an existing entity {} with {}", oldCast, entity); + } + } -+ // Paper end ++ // Paper end - extra debug info } else { this.byUuid.put(uuid, entity); this.byId.put(entity.getId(), entity); diff --git a/paper-server/patches/sources/net/minecraft/world/level/levelgen/DensityFunctions.java.patch b/paper-server/patches/sources/net/minecraft/world/level/levelgen/DensityFunctions.java.patch index 96d7029c39..087b4b7d6d 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/levelgen/DensityFunctions.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/levelgen/DensityFunctions.java.patch @@ -17,7 +17,7 @@ public EndIslandDensityFunction(long seed) { RandomSource randomSource = new LegacyRandomSource(seed); -@@ -518,15 +_,29 @@ +@@ -518,15 +_,31 @@ int i1 = z / 2; int i2 = x % 2; int i3 = z % 2; @@ -28,22 +28,25 @@ + NoiseCache cache = noiseCache.get().computeIfAbsent(noise, noiseKey -> new NoiseCache()); // Paper - Perf: Optimize end generation for (int i4 = -12; i4 <= 12; i4++) { for (int i5 = -12; i5 <= 12; i5++) { - long l = i + i4; - long l1 = i1 + i5; -- if (l * l + l1 * l1 > 4096L && noise.getValue(l, l1) < -0.9F) { -- float f1 = (Mth.abs((float)l) * 3439.0F + Mth.abs((float)l1) * 147.0F) % 13.0F + 9.0F; +- long l = i + i4; +- long l1 = i1 + i5; ++ long l = i + i4; final int chunkX = (int) l; // Paper - OBFHELPER ++ long l1 = i1 + i5; final int chunkZ = (int) l1; // Paper - OBFHELPER + // Paper start - Perf: Optimize end generation by using a noise cache -+ long key = net.minecraft.world.level.ChunkPos.asLong((int) l, (int) l); -+ int index = (int) it.unimi.dsi.fastutil.HashCommon.mix(key) & 8191; -+ float f1 = Float.MIN_VALUE; -+ if (cache.keys[index] == key) { -+ f1 = cache.values[index]; ++ final long chunkKey = net.minecraft.world.level.ChunkPos.asLong(chunkX, chunkZ); ++ final int cacheIndex = (int) it.unimi.dsi.fastutil.HashCommon.mix(chunkKey) & 8191; ++ float f1 = Float.MIN_VALUE; // noise value ++ if (cache.keys[cacheIndex] == chunkKey) { ++ // Use cache ++ f1 = cache.values[cacheIndex]; + } else { -+ if (l * l + l1 * l1 > 4096L && noise.getValue((double)l, (double)l1) < -0.9F) { -+ f1 = (Mth.abs((float)l) * 3439.0F + Mth.abs((float)l1) * 147.0F) % 13.0F + 9.0F; -+ } -+ cache.keys[index] = key; -+ cache.values[index] = f1; ++ // Vanilla function + if (l * l + l1 * l1 > 4096L && noise.getValue(l, l1) < -0.9F) { +- float f1 = (Mth.abs((float)l) * 3439.0F + Mth.abs((float)l1) * 147.0F) % 13.0F + 9.0F; ++ f1 = (Mth.abs((float)l) * 3439.0F + Mth.abs((float)l1) * 147.0F) % 13.0F + 9.0F; ++ } ++ cache.keys[cacheIndex] = chunkKey; ++ cache.values[cacheIndex] = f1; + } + if (f1 != Float.MIN_VALUE) { + // Paper end - Perf: Optimize end generation |