From 35ef2932bee3b0bda4afbb5cca7a76e5af58f351 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Fri, 25 Oct 2024 11:40:25 -0700 Subject: [PATCH] Finish rebase --- ....patch => 1037-fixup-ConcurrentUtil.patch} | 0 ...ch => 1038-fixup-Paper-config-files.patch} | 0 ...-Utils.patch => 1039-fixup-MC-Utils.patch} | 21 +- ...> 1040-Rewrite-dataconverter-system.patch} | 8 +- ...timize-BlockPosition-helper-methods.patch} | 2 +- ...tch => 1042-fixup-More-Teleport-API.patch} | 4 +- ... 1043-Moonrise-optimisation-patches.patch} | 297 +++++++++--------- patches/server/2979-fixup-Timings-v2.patch | 18 -- 8 files changed, 161 insertions(+), 189 deletions(-) rename patches/server/{2973-fixup-ConcurrentUtil.patch => 1037-fixup-ConcurrentUtil.patch} (100%) rename patches/server/{0974-fixup-Paper-config-files.patch => 1038-fixup-Paper-config-files.patch} (100%) rename patches/server/{2975-fixup-MC-Utils.patch => 1039-fixup-MC-Utils.patch} (99%) rename patches/server/{2976-Rewrite-dataconverter-system.patch => 1040-Rewrite-dataconverter-system.patch} (99%) rename patches/server/{2977-fixup-Optimize-BlockPosition-helper-methods.patch => 1041-fixup-Optimize-BlockPosition-helper-methods.patch} (96%) rename patches/server/{2978-fixup-More-Teleport-API.patch => 1042-fixup-More-Teleport-API.patch} (90%) rename patches/server/{2980-Moonrise-optimisation-patches.patch => 1043-Moonrise-optimisation-patches.patch} (99%) delete mode 100644 patches/server/2979-fixup-Timings-v2.patch diff --git a/patches/server/2973-fixup-ConcurrentUtil.patch b/patches/server/1037-fixup-ConcurrentUtil.patch similarity index 100% rename from patches/server/2973-fixup-ConcurrentUtil.patch rename to patches/server/1037-fixup-ConcurrentUtil.patch diff --git a/patches/server/0974-fixup-Paper-config-files.patch b/patches/server/1038-fixup-Paper-config-files.patch similarity index 100% rename from patches/server/0974-fixup-Paper-config-files.patch rename to patches/server/1038-fixup-Paper-config-files.patch diff --git a/patches/server/2975-fixup-MC-Utils.patch b/patches/server/1039-fixup-MC-Utils.patch similarity index 99% rename from patches/server/2975-fixup-MC-Utils.patch rename to patches/server/1039-fixup-MC-Utils.patch index 2699280787..06f2a7898c 100644 --- a/patches/server/2975-fixup-MC-Utils.patch +++ b/patches/server/1039-fixup-MC-Utils.patch @@ -1022,14 +1022,14 @@ index 11b7f15755dde766140c29bedca456c80d53293f..217d1f908a36a5177ba3cbb80a33f73d } diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/WorldUtil.java b/src/main/java/ca/spottedleaf/moonrise/common/util/WorldUtil.java -index af9623240ff2d389aa7090623f507720e7dbab7d..efda2688ae1254a82ba7f6bf8bf597ef224cbb86 100644 +index 561a1a3ff418393d0a0db58de91b336f4c33aa4e..efda2688ae1254a82ba7f6bf8bf597ef224cbb86 100644 --- a/src/main/java/ca/spottedleaf/moonrise/common/util/WorldUtil.java +++ b/src/main/java/ca/spottedleaf/moonrise/common/util/WorldUtil.java -@@ -8,11 +8,19 @@ public final class WorldUtil { +@@ -8,13 +8,21 @@ public final class WorldUtil { // min, max are inclusive public static int getMaxSection(final LevelHeightAccessor world) { -- return world.getMaxSection() - 1; // getMaxSection() is exclusive +- return world.getMaxSectionY() - 1; // getMaxSection() is exclusive + return world.getMaxSectionY(); + } + @@ -1038,15 +1038,16 @@ index af9623240ff2d389aa7090623f507720e7dbab7d..efda2688ae1254a82ba7f6bf8bf597ef } public static int getMinSection(final LevelHeightAccessor world) { -- return world.getMinSection(); + return world.getMinSectionY(); + } + ++ public static int getMinSection(final Level world) { + return world.getMinSectionY(); + } + -+ public static int getMinSection(final Level world) { -+ return world.getMinSectionY(); - } - public static int getMaxLightSection(final LevelHeightAccessor world) { + return getMaxSection(world) + 1; + } diff --git a/src/main/java/ca/spottedleaf/moonrise/paper/PaperHooks.java b/src/main/java/ca/spottedleaf/moonrise/paper/PaperHooks.java new file mode 100644 index 0000000000000000000000000000000000000000..1aa6be257ce594d7a69fdff008cd29014a04fd75 @@ -1276,10 +1277,10 @@ index 4954ed9edf1e1f54cc164e48817eb5b75ea87ce0..8a0cb603cd4dbfa1839e0f4e1606876c } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 2aa4437a76d29cdd793680734a36a41c6133ab91..0cf4f9d60337cfe89075a79eabfd182cdec91695 100644 +index c17824fa01c4682c2b97bb60bfa401a1a2ef9c12..878bd04b63f257cc625953e45b953beb06917107 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -272,7 +272,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -271,7 +271,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe return true; } diff --git a/patches/server/2976-Rewrite-dataconverter-system.patch b/patches/server/1040-Rewrite-dataconverter-system.patch similarity index 99% rename from patches/server/2976-Rewrite-dataconverter-system.patch rename to patches/server/1040-Rewrite-dataconverter-system.patch index 90d6b4c947..c56d13c873 100644 --- a/patches/server/2976-Rewrite-dataconverter-system.patch +++ b/patches/server/1040-Rewrite-dataconverter-system.patch @@ -30343,7 +30343,7 @@ index 05a76f9d18638f10218161450470f07524b723ac..3ab22c384bb8a7772d389977a61d0e28 } diff --git a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java -index b5abdd1498a3d19559149c30ba959aa2bcf0246c..0c2e827f4ee53ed2723da60f08a6cf96769bbdfa 100644 +index 79397b3c76e4b9d2ee03dfa16c2daf4f71ae8b4d..cdca5ae69991cc068bfbc0686b5defb3604a5440 100644 --- a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java +++ b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java @@ -277,12 +277,21 @@ public class LevelStorageSource { @@ -30384,10 +30384,10 @@ index b54a3741cd3ba615c83c98985cb4b3c4c586ed7a..b148cf247acdd36f856d0495cde4cc5a return nbttagcompound; }); diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index b24ccbff89db873f5bdf62cbebcca0049b94a8d5..1cda41b104935743cb18e19acca24ad0a1673bb6 100644 +index 2a5c5e9e04d90c4e218b200bb55ff6bf2877ad73..bc53c263682ada9eebcaccc13e741844d310a7a6 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -511,7 +511,7 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -507,7 +507,7 @@ public final class CraftMagicNumbers implements UnsafeValues { net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data); final int dataVersion = compound.getInt("DataVersion"); @@ -30396,7 +30396,7 @@ index b24ccbff89db873f5bdf62cbebcca0049b94a8d5..1cda41b104935743cb18e19acca24ad0 return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow()); } -@@ -532,7 +532,7 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -561,7 +561,7 @@ public final class CraftMagicNumbers implements UnsafeValues { net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data); int dataVersion = compound.getInt("DataVersion"); diff --git a/patches/server/2977-fixup-Optimize-BlockPosition-helper-methods.patch b/patches/server/1041-fixup-Optimize-BlockPosition-helper-methods.patch similarity index 96% rename from patches/server/2977-fixup-Optimize-BlockPosition-helper-methods.patch rename to patches/server/1041-fixup-Optimize-BlockPosition-helper-methods.patch index 5a70b45e95..061b6c4ffe 100644 --- a/patches/server/2977-fixup-Optimize-BlockPosition-helper-methods.patch +++ b/patches/server/1041-fixup-Optimize-BlockPosition-helper-methods.patch @@ -5,7 +5,7 @@ Subject: [PATCH] fixup! Optimize BlockPosition helper methods diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index 0d51fb4be8b49e3b57c3c55aff6bcf13d5c78ddd..a1d54d978d34d75475f92dfb806113586e7e449c 100644 +index a5dab9b1652ac76372d88316e2c165eed6317891..f58a94efafbc01d402cd03a108bb90f60930a316 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java @@ -162,7 +162,7 @@ public class BlockPos extends Vec3i { diff --git a/patches/server/2978-fixup-More-Teleport-API.patch b/patches/server/1042-fixup-More-Teleport-API.patch similarity index 90% rename from patches/server/2978-fixup-More-Teleport-API.patch rename to patches/server/1042-fixup-More-Teleport-API.patch index f3e4c5eea5..9ef4eadd58 100644 --- a/patches/server/2978-fixup-More-Teleport-API.patch +++ b/patches/server/1042-fixup-More-Teleport-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] fixup! More Teleport API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index c1d3dd2bd217efd6914bceb1027fa12b06c22a55..7536ab5c22d97a074c08a95fff6bc756d61e387d 100644 +index 64c6f54cc4d0c22bc972b808cb92925cc7526db2..179886dcbda29c5cdb7dbd43e44951ae38d9df96 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1060,7 +1060,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1064,7 +1064,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { java.util.concurrent.CompletableFuture ret = new java.util.concurrent.CompletableFuture<>(); world.loadChunksForMoveAsync(getHandle().getBoundingBoxAt(locationClone.getX(), locationClone.getY(), locationClone.getZ()), diff --git a/patches/server/2980-Moonrise-optimisation-patches.patch b/patches/server/1043-Moonrise-optimisation-patches.patch similarity index 99% rename from patches/server/2980-Moonrise-optimisation-patches.patch rename to patches/server/1043-Moonrise-optimisation-patches.patch index 4db77860f7..6c028f78a6 100644 --- a/patches/server/2980-Moonrise-optimisation-patches.patch +++ b/patches/server/1043-Moonrise-optimisation-patches.patch @@ -23342,7 +23342,7 @@ index 3fde5abde736b2c19d8819d9aec0397a0245ccd1..6548302d4983bf48cc6bc2b7f4833dc7 + // Paper end - optimise collisions } diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java -index 71e04e5c1bc0722abf8ca2e0738bd60b6d7ae21c..8e0dfaf02343d74ce786e4fc647bc4c1d73c0014 100644 +index 063630c1ffcce099139c59d598fc5a210e21f640..a61153c5d99bdc26f37a10f33baf839e943e17e1 100644 --- a/src/main/java/net/minecraft/core/MappedRegistry.java +++ b/src/main/java/net/minecraft/core/MappedRegistry.java @@ -50,6 +50,19 @@ public class MappedRegistry implements WritableRegistry { @@ -23386,7 +23386,7 @@ index fc6ce3485dc890f5105a37fe3e344a1460867556..e114e687f2f4503546687fd6792226a6 DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, worldLoader.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services, LoggerChunkProgressListener::createFromGameruleRadius); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 21660e4284cfabb333a3edf9224c892ef80b2403..a73e4aaee436405caf88ac0ebe3ed7451310247c 100644 +index 6d0cfaaf414931d9fd8eee417f4b70ac6679de10..407463d7c6ba5d69e722613fa41ffc0a500123b9 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -205,7 +205,7 @@ import org.bukkit.event.server.ServerLoadEvent; @@ -23582,7 +23582,7 @@ index 21660e4284cfabb333a3edf9224c892ef80b2403..a73e4aaee436405caf88ac0ebe3ed745 return true; } else { boolean ret = false; // Paper - force execution of all worlds, do not just bias the first -@@ -2731,6 +2811,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> onLoad) { @@ -26821,7 +26821,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 int minBlockX = Mth.floor(axisalignedbb.minX - 1.0E-7D) - 3; int maxBlockX = Mth.floor(axisalignedbb.maxX + 1.0E-7D) + 3; -@@ -295,30 +287,159 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -294,30 +286,159 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe int minChunkZ = minBlockZ >> 4; int maxChunkZ = maxBlockZ >> 4; @@ -26995,7 +26995,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 } } } -@@ -326,22 +447,137 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -325,22 +446,137 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe for (int cx = minChunkX; cx <= maxChunkX; ++cx) { for (int cz = minChunkZ; cz <= maxChunkZ; ++cz) { @@ -27143,7 +27143,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 // Add env and gen to constructor, IWorldDataServer -> WorldDataServer public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { -@@ -375,14 +611,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -374,14 +610,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe DataFixer datafixer = minecraftserver.getFixerUpper(); EntityPersistentStorage entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver); @@ -27161,7 +27161,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 return minecraftserver.overworld().getDataStorage(); }); this.chunkSource.getGeneratorState().ensureStructuresGenerated(); -@@ -410,6 +645,20 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -409,6 +644,20 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> { return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences"); }); @@ -27182,7 +27182,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit } -@@ -542,7 +791,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -541,7 +790,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe gameprofilerfiller.push("checkDespawn"); entity.checkDespawn(); gameprofilerfiller.pop(); @@ -27191,7 +27191,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 Entity entity1 = entity.getVehicle(); if (entity1 != null) { -@@ -567,13 +816,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -566,13 +815,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } gameprofilerfiller.push("entityManagement"); @@ -27210,7 +27210,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 } protected void tickTime() { -@@ -613,7 +865,60 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -612,7 +864,60 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe }); } @@ -27271,7 +27271,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 ChunkPos chunkcoordintpair = chunk.getPos(); boolean flag = this.isRaining(); int j = chunkcoordintpair.getMinBlockX(); -@@ -621,7 +926,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -620,7 +925,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe ProfilerFiller gameprofilerfiller = Profiler.get(); gameprofilerfiller.push("thunder"); @@ -27280,7 +27280,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 BlockPos blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15)); if (this.isRainingAt(blockposition)) { -@@ -653,7 +958,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -652,7 +957,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow for (int l = 0; l < randomTickSpeed; ++l) { @@ -27289,7 +27289,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 this.tickPrecipitation(this.getBlockRandomPos(j, 0, k, 15)); } } -@@ -662,35 +967,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -661,35 +966,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe gameprofilerfiller.popPush("tickBlocks"); timings.chunkTicksBlocks.startTiming(); // Paper if (randomTickSpeed > 0) { @@ -27326,7 +27326,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 } timings.chunkTicksBlocks.stopTiming(); // Paper -@@ -964,6 +1241,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -963,6 +1240,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (fluid1.is(fluid)) { fluid1.tick(this, pos, iblockdata); } @@ -27338,7 +27338,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 } -@@ -973,6 +1255,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -972,6 +1254,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (iblockdata.is(block)) { iblockdata.tick(this, pos, this.random); } @@ -27350,7 +27350,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 } -@@ -1049,6 +1336,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1060,6 +1347,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } public void save(@Nullable ProgressListener progressListener, boolean flush, boolean savingDisabled) { @@ -27362,7 +27362,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 ServerChunkCache chunkproviderserver = this.getChunkSource(); if (!savingDisabled) { -@@ -1064,16 +1356,21 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1075,16 +1367,21 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } timings.worldSaveChunks.startTiming(); // Paper @@ -27390,7 +27390,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 // CraftBukkit start - moved from MinecraftServer.saveChunks ServerLevel worldserver1 = this; -@@ -1213,7 +1510,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1224,7 +1521,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED); } @@ -27399,7 +27399,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 } // CraftBukkit start -@@ -1244,7 +1541,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1255,7 +1552,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } // CraftBukkit end @@ -27408,7 +27408,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 } } -@@ -1255,11 +1552,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1266,11 +1563,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public boolean tryAddFreshEntityWithPassengers(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) { // CraftBukkit end @@ -27421,7 +27421,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 return false; } else { this.addFreshEntityWithPassengers(entity, reason); // CraftBukkit -@@ -1914,7 +2207,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1930,7 +2223,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } } @@ -27430,7 +27430,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 bufferedwriter.write(String.format(Locale.ROOT, "block_entity_tickers: %d\n", this.blockEntityTickers.size())); bufferedwriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count())); bufferedwriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count())); -@@ -1963,7 +2256,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1979,7 +2272,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1); try { @@ -27439,7 +27439,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 } catch (Throwable throwable4) { if (bufferedwriter2 != null) { try { -@@ -1984,7 +2277,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2000,7 +2293,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2); try { @@ -27448,7 +27448,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 } catch (Throwable throwable6) { if (bufferedwriter3 != null) { try { -@@ -2126,7 +2419,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2142,7 +2435,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @VisibleForTesting public String getWatchdogStats() { @@ -27457,7 +27457,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); }), this.blockEntityTickers.size(), ServerLevel.getTypeCount(this.blockEntityTickers, TickingBlockEntity::getType), this.getBlockTicks().count(), this.getFluidTicks().count(), this.gatherChunkSourceStats()); } -@@ -2156,15 +2449,25 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2172,15 +2465,25 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @Override public LevelEntityGetter getEntities() { org.spigotmc.AsyncCatcher.catchOp("Chunk getEntities call"); // Spigot @@ -27486,7 +27486,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 } public void startTickingChunk(LevelChunk chunk) { -@@ -2184,34 +2487,47 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2200,34 +2503,47 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @Override public void close() throws IOException { super.close(); @@ -27541,7 +27541,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 } @Override -@@ -2267,7 +2583,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2283,7 +2599,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report); crashreportsystemdetails.setDetail("Loaded entity count", () -> { @@ -27551,7 +27551,7 @@ index 0cf4f9d60337cfe89075a79eabfd182cdec91695..7066a51f0f13915e2378be364b1144f7 return crashreportsystemdetails; } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 52b18f2c333b7535929bb4e52e65cf5fb0f5692f..cff36fc36829194c7fe5991f2a55d23ad18017a6 100644 +index e2527f3e2b96df539c765ae23c83a09d3298d430..8ceeebb561046933cba0725e15732fa074226884 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -218,7 +218,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -28031,24 +28031,11 @@ index b7d29389a357f142237cecd75f8ca91cf1eb6b5b..e4b0dc3121101d54394a0c3a413dabf8 public WorldGenRegion(ServerLevel world, StaticCache2D chunks, ChunkStep generationStep, ChunkAccess centerPos) { this.generatingStep = generationStep; this.cache = chunks; -diff --git a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -index cdd66e6ce96e2613afe7f06ca8da3cfaa6704b2d..32634e45ac8433648e49e47e20081e15ad41ff15 100644 ---- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -+++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -@@ -78,7 +78,7 @@ public class PlayerChunkSender { - } - } - -- private static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { -+ public static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { // Paper - public - handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null)); - // Paper start - PlayerChunkLoadEvent - if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index a4937d11b79cef41f3fbf79282c0c435e794dbfe..be7f437a8d2bf1d5c2314848cbf9379c5cf25fde 100644 +index 90c469193ecf9d04dd9e3f1a38157d47c5094985..bbefb529607d1cffe8917b883389494a8fa126c0 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1416,7 +1416,7 @@ public abstract class PlayerList { +@@ -1422,7 +1422,7 @@ public abstract class PlayerList { public void setViewDistance(int viewDistance) { this.viewDistance = viewDistance; @@ -28435,7 +28422,7 @@ index 50040c497a819cd1229042ab3cb057d34a32cacc..1f9c436a632e4f110be61cf76fcfc3b7 + // Paper end - block counting } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3d4bb855dec45685d6e336d913903341f0ca4a11..4e005543cba9cfad6aeb39094cb856f5406c585a 100644 +index faa239dcb9b7b608911b464c3665c8b064ee6c41..68dec563d9725daa0044781395a840ac5d61b9b5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -175,7 +175,7 @@ import org.bukkit.event.player.PlayerTeleportEvent; @@ -28447,7 +28434,7 @@ index 3d4bb855dec45685d6e336d913903341f0ca4a11..4e005543cba9cfad6aeb39094cb856f5 // CraftBukkit start private static final int CURRENT_LEVEL = 2; -@@ -457,6 +457,156 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -460,6 +460,156 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return this.dimensions.makeBoundingBox(x, y, z); } // Paper end @@ -28604,7 +28591,7 @@ index 3d4bb855dec45685d6e336d913903341f0ca4a11..4e005543cba9cfad6aeb39094cb856f5 public Entity(EntityType type, Level world) { this.id = Entity.ENTITY_COUNTER.incrementAndGet(); -@@ -1320,41 +1470,76 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1365,41 +1515,76 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } private Vec3 collide(Vec3 movement) { @@ -28709,7 +28696,7 @@ index 3d4bb855dec45685d6e336d913903341f0ca4a11..4e005543cba9cfad6aeb39094cb856f5 } private static float[] collectCandidateStepUpHeights(AABB collisionBox, List collisions, float f, float stepHeight) { -@@ -2742,18 +2927,110 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2787,18 +2972,110 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public boolean isInWall() { @@ -28827,7 +28814,7 @@ index 3d4bb855dec45685d6e336d913903341f0ca4a11..4e005543cba9cfad6aeb39094cb856f5 } public InteractionResult interact(Player player, InteractionHand hand) { -@@ -4224,14 +4501,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4269,14 +4546,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public Iterable getIndirectPassengers() { @@ -28852,7 +28839,7 @@ index 3d4bb855dec45685d6e336d913903341f0ca4a11..4e005543cba9cfad6aeb39094cb856f5 } private Iterable getIndirectPassengers_old() { // Paper end - Optimize indirect passenger iteration -@@ -4360,82 +4640,136 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4405,82 +4685,136 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return Mth.lerp(delta, this.yRotO, this.yRot); } @@ -29047,7 +29034,7 @@ index 3d4bb855dec45685d6e336d913903341f0ca4a11..4e005543cba9cfad6aeb39094cb856f5 public boolean touchingUnloadedChunk() { AABB axisalignedbb = this.getBoundingBox().inflate(1.0D); -@@ -4587,6 +4921,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4632,6 +4966,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.setPosRaw(x, y, z, false); } public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) { @@ -29063,7 +29050,7 @@ index 3d4bb855dec45685d6e336d913903341f0ca4a11..4e005543cba9cfad6aeb39094cb856f5 if (!checkPosition(this, x, y, z)) { return; } -@@ -4716,6 +5059,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4761,6 +5104,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @Override public final void setRemoved(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { @@ -29076,7 +29063,7 @@ index 3d4bb855dec45685d6e336d913903341f0ca4a11..4e005543cba9cfad6aeb39094cb856f5 CraftEventFactory.callEntityRemoveEvent(this, cause); // CraftBukkit end final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers -@@ -4727,7 +5076,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4772,7 +5121,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.stopRiding(); } @@ -29085,7 +29072,7 @@ index 3d4bb855dec45685d6e336d913903341f0ca4a11..4e005543cba9cfad6aeb39094cb856f5 this.levelCallback.onRemove(entity_removalreason); this.onRemoval(entity_removalreason); // Paper start - Folia schedulers -@@ -4759,7 +5108,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4804,7 +5153,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @Override public boolean shouldBeSaved() { @@ -29484,7 +29471,7 @@ index e185a33b5b1f8e8e0a0e666b24ba3e9186a8a7ff..5d7a6e4b73f032db356e7ec369b15001 // Paper start - Affects Spawning API diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 1b899473c6deeaa1aef9007d8b7bcec98580e61c..1f4ff796a1f69b9c60d32d407b5579e89433089c 100644 +index ce6c9b82a64a32c4b952d1839260015b1a446365..bb2d3ba2065b6bf67af24a8630ac2d58169fe783 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -83,6 +83,7 @@ import net.minecraft.world.level.storage.LevelData; @@ -29504,7 +29491,7 @@ index 1b899473c6deeaa1aef9007d8b7bcec98580e61c..1f4ff796a1f69b9c60d32d407b5579e8 public static final Codec> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION); public static final ResourceKey OVERWORLD = ResourceKey.create(Registries.DIMENSION, ResourceLocation.withDefaultNamespace("overworld")); -@@ -200,7 +201,639 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -207,7 +208,639 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public abstract ResourceKey getTypeKey(); @@ -30131,7 +30118,7 @@ index 1b899473c6deeaa1aef9007d8b7bcec98580e61c..1f4ff796a1f69b9c60d32d407b5579e8 + } + // Paper end - optimise random ticking + - protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, RegistryAccess iregistrycustom, Holder holder, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function paperWorldConfigCreator) { // Paper - create paper world config + protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, RegistryAccess iregistrycustom, Holder holder, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config & Anti-Xray + // Paper start - getblock optimisations - cache world height/sections + final DimensionType dimType = holder.value(); + this.minY = dimType.minY(); @@ -30144,15 +30131,15 @@ index 1b899473c6deeaa1aef9007d8b7bcec98580e61c..1f4ff796a1f69b9c60d32d407b5579e8 this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config this.generator = gen; -@@ -281,6 +914,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings +@@ -289,6 +922,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime); + this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray + this.entityLookup = new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.dfl.DefaultEntityLookup(this); // Paper - rewrite chunk system } // Paper start - Cancel hit for vanished players -@@ -549,7 +1183,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -558,7 +1192,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.setBlocksDirty(blockposition, iblockdata1, iblockdata2); } @@ -30161,7 +30148,7 @@ index 1b899473c6deeaa1aef9007d8b7bcec98580e61c..1f4ff796a1f69b9c60d32d407b5579e8 this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i); } -@@ -815,6 +1449,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -824,6 +1458,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Iterator iterator = this.blockEntityTickers.iterator(); boolean flag = this.tickRateManager().runsNormally(); @@ -30170,7 +30157,7 @@ index 1b899473c6deeaa1aef9007d8b7bcec98580e61c..1f4ff796a1f69b9c60d32d407b5579e8 int tilesThisCycle = 0; var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet(); // Paper - Fix MC-117075; use removeAll toRemove.add(null); // Paper - Fix MC-117075 -@@ -830,6 +1466,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -839,6 +1475,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Spigot end } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) { tickingblockentity.tick(); @@ -30182,7 +30169,7 @@ index 1b899473c6deeaa1aef9007d8b7bcec98580e61c..1f4ff796a1f69b9c60d32d407b5579e8 } } this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 -@@ -852,12 +1493,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -861,12 +1502,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable { entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); // Paper end - Prevent block entity and entity crashes } @@ -30204,7 +30191,7 @@ index 1b899473c6deeaa1aef9007d8b7bcec98580e61c..1f4ff796a1f69b9c60d32d407b5579e8 } // Paper end - Option to prevent armor stands from doing entity lookups -@@ -909,7 +1558,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -918,7 +1567,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } // Paper end - Perf: Optimize capturedTileEntities lookup // CraftBukkit end @@ -30213,7 +30200,7 @@ index 1b899473c6deeaa1aef9007d8b7bcec98580e61c..1f4ff796a1f69b9c60d32d407b5579e8 } public void setBlockEntity(BlockEntity blockEntity) { -@@ -1001,26 +1650,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1010,26 +1659,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { Profiler.get().incrementCounter("getEntities"); List list = Lists.newArrayList(); @@ -30246,7 +30233,7 @@ index 1b899473c6deeaa1aef9007d8b7bcec98580e61c..1f4ff796a1f69b9c60d32d407b5579e8 } @Override -@@ -1035,36 +1673,94 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1044,36 +1682,94 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.getEntities(filter, box, predicate, result, Integer.MAX_VALUE); } @@ -31364,7 +31351,7 @@ index fcf04c5c58ff35d38c5bf0df562ae2f8dc98a0ee..0b116160924300a9d62ad5948bfaf276 public Property.Value value(T value) { diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index 37795b9e264c571efe9c718fa9996197dca4ed54..0601f454758cb1447cca2cbff4ef5fd7633fece5 100644 +index 63d7d6b93119d96d753230472df30a9dedd889dc..a402e2f774cfc062afab8d86969f3e6f38874063 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java @@ -57,7 +57,7 @@ import net.minecraft.world.ticks.SavedTick; @@ -31453,7 +31440,7 @@ index 37795b9e264c571efe9c718fa9996197dca4ed54..0601f454758cb1447cca2cbff4ef5fd7 if (this.sections.length == sectionArray.length) { System.arraycopy(sectionArray, 0, this.sections, 0, this.sections.length); @@ -111,6 +162,16 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh - ChunkAccess.replaceMissingSections(biomeRegistry, this.sections); + this.replaceMissingSections(biomeRegistry, this.sections); // Paper - Anti-Xray - make it a non-static method // CraftBukkit start this.biomeRegistry = biomeRegistry; + // Paper start - rewrite chunk system @@ -31469,7 +31456,7 @@ index 37795b9e264c571efe9c718fa9996197dca4ed54..0601f454758cb1447cca2cbff4ef5fd7 } public final Registry biomeRegistry; // CraftBukkit end -@@ -451,22 +512,22 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh +@@ -452,22 +513,22 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh @Override public Holder getNoiseBiome(int biomeX, int biomeY, int biomeZ) { @@ -31507,7 +31494,7 @@ index 37795b9e264c571efe9c718fa9996197dca4ed54..0601f454758cb1447cca2cbff4ef5fd7 } // CraftBukkit start -@@ -523,12 +584,12 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh +@@ -524,12 +585,12 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh } public void initializeLightSources() { @@ -31523,7 +31510,7 @@ index 37795b9e264c571efe9c718fa9996197dca4ed54..0601f454758cb1447cca2cbff4ef5fd7 public static record PackedTicks(List> blocks, List> fluids) { diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index 4cbc68d8e950f8d7c8b00535b82e916964c88ce0..12148b80794f620799e44f59f0251bb27e74f2c9 100644 +index 582065b2d4e818c0edec36b2e9847f8ed3266b10..b5114f84b2df2f4606702b892d32d484225d9dcf 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java @@ -119,7 +119,7 @@ public abstract class ChunkGenerator { @@ -31624,7 +31611,7 @@ index 98dbeaf8bde15940e5b5d5d1f13fd4bb32f0a10d..7beea075b5a7ef738a4ac0558b99f4c5 this(idList, bits, listener); entries.forEach(this.values::add); diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -index 7cce66d4c6efe6fd3cc22a6acf72878c964c61ae..30ee3df2278d0d9bd7478b49eda5fff27b8a504c 100644 +index f38700e5fbeeb8a913272d4464b8aa325d511dac..1eb8022f3e31603322e6c56516304afc9a11bbec 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java @@ -30,7 +30,7 @@ import net.minecraft.world.level.material.FluidState; @@ -31686,7 +31673,7 @@ index 7cce66d4c6efe6fd3cc22a6acf72878c964c61ae..30ee3df2278d0d9bd7478b49eda5fff2 @Override public BlockEntity getBlockEntity(BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 325d1e38a72a4b30f30261267e9adfb8a8726b11..86b018042590c3ce115555639e7791c521cecffc 100644 +index 71dfd0abb930ecf4f1ba900c80c161fa2a858685..e03d57f58a9f962cd429e8851fb3f35f3491e2c0 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -54,7 +54,7 @@ import net.minecraft.world.ticks.LevelChunkTicks; @@ -31865,7 +31852,7 @@ index 325d1e38a72a4b30f30261267e9adfb8a8726b11..86b018042590c3ce115555639e7791c5 @Nullable diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java -index 52f44f14bbda60fe771c351e01e6ff470d7371e6..b85f354afa23ddf7e24facdb0516407ee2725bee 100644 +index 3dab36d00ea48101807ba40c7a7358b7eed12747..e4ae25c83ab9dd1aaa530a5456275ef63cdb8511 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java @@ -13,7 +13,7 @@ import net.minecraft.world.level.block.Blocks; @@ -31908,7 +31895,7 @@ index 52f44f14bbda60fe771c351e01e6ff470d7371e6..b85f354afa23ddf7e24facdb0516407e private LevelChunkSection(LevelChunkSection section) { this.nonEmptyBlockCount = section.nonEmptyBlockCount; this.tickingBlockCount = section.tickingBlockCount; -@@ -64,6 +88,45 @@ public class LevelChunkSection { +@@ -67,6 +91,45 @@ public class LevelChunkSection { return this.setBlockState(x, y, z, state, true); } @@ -31954,7 +31941,7 @@ index 52f44f14bbda60fe771c351e01e6ff470d7371e6..b85f354afa23ddf7e24facdb0516407e public BlockState setBlockState(int x, int y, int z, BlockState state, boolean lock) { BlockState iblockdata1; -@@ -83,7 +146,7 @@ public class LevelChunkSection { +@@ -86,7 +149,7 @@ public class LevelChunkSection { } } @@ -31963,7 +31950,7 @@ index 52f44f14bbda60fe771c351e01e6ff470d7371e6..b85f354afa23ddf7e24facdb0516407e --this.tickingFluidCount; } -@@ -94,10 +157,12 @@ public class LevelChunkSection { +@@ -97,10 +160,12 @@ public class LevelChunkSection { } } @@ -31977,7 +31964,7 @@ index 52f44f14bbda60fe771c351e01e6ff470d7371e6..b85f354afa23ddf7e24facdb0516407e return iblockdata1; } -@@ -118,40 +183,70 @@ public class LevelChunkSection { +@@ -121,40 +186,70 @@ public class LevelChunkSection { } public void recalcBlockCounts() { @@ -32069,7 +32056,7 @@ index 52f44f14bbda60fe771c351e01e6ff470d7371e6..b85f354afa23ddf7e24facdb0516407e } public PalettedContainer getStates() { -@@ -169,6 +264,11 @@ public class LevelChunkSection { +@@ -172,6 +267,11 @@ public class LevelChunkSection { datapaletteblock.read(buf); this.biomes = datapaletteblock; @@ -32121,19 +32108,19 @@ index b8922e4a13df535cdc5701e893a6e460b33ff90d..100807f8b8337f56f49cdb818ccc75be boolean maybeHas(Predicate predicate); diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index 112d1259dd37743076ff6c67ffd711d084ba8698..533167eaa8bd39006fb1c7e193c81359973da9af 100644 +index 69d6f203366df658e1ade55d917f0aa2b8a49be9..8b84bf2272556ac3321cbf16361d7f48a1cc6873 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -28,7 +28,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer - private static final int MIN_PALETTE_BITS = 0; +@@ -29,7 +29,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer private final PaletteResize dummyPaletteResize = (newSize, added) -> 0; public final IdMap registry; + private final T @org.jetbrains.annotations.Nullable [] presetValues; // Paper - Anti-Xray - Add preset values - private volatile PalettedContainer.Data data; + public volatile PalettedContainer.Data data; // Paper - optimise collisions - public private final PalettedContainer.Strategy strategy; // private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer"); // Paper - unused -@@ -71,6 +71,33 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -77,6 +77,33 @@ public class PalettedContainer implements PaletteResize, PalettedContainer ); } @@ -32164,25 +32151,26 @@ index 112d1259dd37743076ff6c67ffd711d084ba8698..533167eaa8bd39006fb1c7e193c81359 + } + // Paper end - optimise palette reads + + // Paper start - Anti-Xray - Add preset values + @Deprecated @io.papermc.paper.annotation.DoNotUse public PalettedContainer(IdMap idList, PalettedContainer.Strategy paletteProvider, PalettedContainer.Configuration dataProvider, BitStorage storage, List paletteEntries) { this(idList, paletteProvider, dataProvider, storage, paletteEntries, null, null); } public PalettedContainer( - IdMap idList, - PalettedContainer.Strategy paletteProvider, -@@ -81,12 +108,14 @@ public class PalettedContainer implements PaletteResize, PalettedContainer - this.registry = idList; - this.strategy = paletteProvider; - this.data = new PalettedContainer.Data<>(dataProvider, storage, dataProvider.factory().create(dataProvider.bits(), idList, this, paletteEntries)); +@@ -113,6 +140,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer + } + } + // Paper end + this.updateData(this.data); // Paper - optimise palette reads } - private PalettedContainer(IdMap idList, PalettedContainer.Strategy paletteProvider, PalettedContainer.Data data) { + // Paper start - Anti-Xray - Add preset values +@@ -122,6 +150,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer this.registry = idList; this.strategy = paletteProvider; this.data = data; + this.updateData(this.data); // Paper - optimise palette reads } - private PalettedContainer(PalettedContainer container) { -@@ -100,6 +129,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer + private PalettedContainer(PalettedContainer container, T @org.jetbrains.annotations.Nullable [] presetValues) { // Paper - Anti-Xray - Add preset values +@@ -140,6 +169,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer this.registry = idList; this.data = this.createOrReuseData(null, 0); this.data.palette.idFor(object); @@ -32190,15 +32178,15 @@ index 112d1259dd37743076ff6c67ffd711d084ba8698..533167eaa8bd39006fb1c7e193c81359 } private PalettedContainer.Data createOrReuseData(@Nullable PalettedContainer.Data previousData, int bits) { -@@ -115,6 +145,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer - PalettedContainer.Data data2 = this.createOrReuseData(data, newBits); +@@ -166,6 +196,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer data2.copyFrom(data.palette, data.storage); this.data = data2; + this.addPresetValues(); + this.updateData(this.data); // Paper - optimise palette reads - return data2.palette.idFor(object); + return object == null ? -1 : data2.palette.idFor(object); + // Paper end } - -@@ -136,9 +167,12 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -198,9 +229,12 @@ public class PalettedContainer implements PaletteResize, PalettedContainer } private synchronized T getAndSet(int index, T value) { // Paper - synchronize @@ -32214,7 +32202,7 @@ index 112d1259dd37743076ff6c67ffd711d084ba8698..533167eaa8bd39006fb1c7e193c81359 } public void set(int x, int y, int z, T value) { -@@ -161,9 +195,11 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -223,9 +257,11 @@ public class PalettedContainer implements PaletteResize, PalettedContainer return this.get(this.strategy.getIndex(x, y, z)); } @@ -32229,15 +32217,15 @@ index 112d1259dd37743076ff6c67ffd711d084ba8698..533167eaa8bd39006fb1c7e193c81359 } @Override -@@ -183,6 +219,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer - data.palette.read(buf); +@@ -246,6 +282,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer buf.readLongArray(data.storage.getRaw()); this.data = data; + this.addPresetValues(); // Paper - Anti-Xray - Add preset values (inefficient, but this isn't used by the server) + this.updateData(this.data); // Paper - optimise palette reads } finally { this.release(); } -@@ -323,7 +360,44 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -394,7 +431,44 @@ public class PalettedContainer implements PaletteResize, PalettedContainer void accept(T object, int count); } @@ -32284,10 +32272,10 @@ index 112d1259dd37743076ff6c67ffd711d084ba8698..533167eaa8bd39006fb1c7e193c81359 for (int i = 0; i < storage.getSize(); i++) { T object = palette.valueFor(storage.get(i)); diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -index 5321109ca638036572df9a7e17eafcef2b4f5112..5304254587372465c8ce821d7aa38b39a979f46b 100644 +index 4d5704df4a7ac6e148774f1a986d46bfb7e95f95..360edef3634bc61f36e41d63d168449df5d50933 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -@@ -145,7 +145,7 @@ public class ProtoChunk extends ChunkAccess { +@@ -149,7 +149,7 @@ public class ProtoChunk extends ChunkAccess { } if (LightEngine.hasDifferentLightProperties(blockState, state)) { @@ -32750,10 +32738,10 @@ index cb823d342e41b5861adfc847a313c265fb702a4c..2b1ea97199d5976e5ff4bd049c1e6c8b private final Long2ObjectLinkedOpenHashMap> regionCacheForBlender = new Long2ObjectLinkedOpenHashMap<>(); private static final int REGION_CACHE_SIZE = 1024; diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index e858436bcf1b234d4bc6e6a117f5224d5c2d9f90..47560d1763d2e70e609cec63ea2defde3d012eb1 100644 +index e761b63eebc1e76b2bb1cb887d83d0b63ad6ec90..e9e1ab1a5be996bc648a53dc4d4123a6b966c437 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -@@ -25,7 +25,7 @@ import net.minecraft.util.profiling.jfr.JvmProfiler; +@@ -28,7 +28,7 @@ import net.minecraft.nbt.NbtIo; // Paper import net.minecraft.world.level.ChunkPos; import org.slf4j.Logger; @@ -32762,7 +32750,7 @@ index e858436bcf1b234d4bc6e6a117f5224d5c2d9f90..47560d1763d2e70e609cec63ea2defde private static final Logger LOGGER = LogUtils.getLogger(); private static final int SECTOR_BYTES = 4096; -@@ -49,6 +49,21 @@ public class RegionFile implements AutoCloseable { +@@ -52,6 +52,21 @@ public class RegionFile implements AutoCloseable { @VisibleForTesting protected final RegionBitmap usedSectors; @@ -32784,7 +32772,7 @@ index e858436bcf1b234d4bc6e6a117f5224d5c2d9f90..47560d1763d2e70e609cec63ea2defde public RegionFile(RegionStorageInfo storageKey, Path directory, Path path, boolean dsync) throws IOException { this(storageKey, directory, path, RegionFileVersion.getCompressionFormat(), dsync); // Paper - Configurable region compression format } -@@ -220,6 +235,16 @@ public class RegionFile implements AutoCloseable { +@@ -224,6 +239,16 @@ public class RegionFile implements AutoCloseable { @Nullable private DataInputStream createExternalChunkInputStream(ChunkPos pos, byte flags) throws IOException { @@ -32801,10 +32789,10 @@ index e858436bcf1b234d4bc6e6a117f5224d5c2d9f90..47560d1763d2e70e609cec63ea2defde Path path = this.getExternalChunkPath(pos); if (!Files.isRegularFile(path, new LinkOption[0])) { -@@ -443,10 +468,29 @@ public class RegionFile implements AutoCloseable { - } +@@ -515,10 +540,29 @@ public class RegionFile implements AutoCloseable { - public static final int MAX_CHUNK_SIZE = 500 * 1024 * 1024; // Paper - don't write garbage data to disk if writing serialization fails + } + // Paper end - private class ChunkBuffer extends ByteArrayOutputStream { + private class ChunkBuffer extends ByteArrayOutputStream implements ca.spottedleaf.moonrise.patches.chunk_system.storage.ChunkSystemChunkBuffer { // Paper - rewrite chunk system @@ -32832,7 +32820,7 @@ index e858436bcf1b234d4bc6e6a117f5224d5c2d9f90..47560d1763d2e70e609cec63ea2defde public ChunkBuffer(final ChunkPos chunkcoordintpair) { super(8096); super.write(0); -@@ -480,7 +524,7 @@ public class RegionFile implements AutoCloseable { +@@ -552,7 +596,7 @@ public class RegionFile implements AutoCloseable { JvmProfiler.INSTANCE.onRegionFileWrite(RegionFile.this.info, this.pos, RegionFile.this.version, i); bytebuffer.putInt(0, i); @@ -32842,7 +32830,7 @@ index e858436bcf1b234d4bc6e6a117f5224d5c2d9f90..47560d1763d2e70e609cec63ea2defde } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 4c1212c6ef48594e766fa9e35a6e15916602d587..9dbc9e2f9d5aab71720bb81803efe76e2f361f04 100644 +index 2a0f7ab0b616fe07baac437372e3933186064dd5..2d5c1b91b814316bf9f2f22bcd30adacc8970b01 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -17,7 +17,7 @@ import net.minecraft.nbt.StreamTagVisitor; @@ -33089,8 +33077,8 @@ index 4c1212c6ef48594e766fa9e35a6e15916602d587..9dbc9e2f9d5aab71720bb81803efe76e + // Paper end - rewrite chunk system } - @Nullable -@@ -132,8 +318,14 @@ public final class RegionFileStorage implements AutoCloseable { + // Paper start +@@ -175,8 +361,14 @@ public final class RegionFileStorage implements AutoCloseable { } @@ -33107,7 +33095,7 @@ index 4c1212c6ef48594e766fa9e35a6e15916602d587..9dbc9e2f9d5aab71720bb81803efe76e // Paper start - Chunk save reattempt int attempts = 0; Exception lastException = null; -@@ -182,30 +374,37 @@ public final class RegionFileStorage implements AutoCloseable { +@@ -226,30 +418,37 @@ public final class RegionFileStorage implements AutoCloseable { } public void close() throws IOException { @@ -33298,10 +33286,10 @@ index 93972352cd4881dccba9b90ccc8dcced3563e340..c3beb7fcad46a917d2b61bd0a0e98e51 static record PackedChunk(Int2ObjectMap sectionsByY, boolean versionChanged) { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java -index b86b3bf713668999a21c4120b1d16c295531b2ad..eb8f5d2efe7c32ddda4763e2ebe0653050101efd 100644 +index eba3e34e5b129050bf6eaed6ce4e690357a3de20..83c87b56205b68010016b58b7f6e4d02f1fa5681 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java -@@ -128,7 +128,7 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun +@@ -129,7 +129,7 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun long j = nbt.getLong("InhabitedTime"); ChunkStatus chunkstatus = ChunkStatus.byName(nbt.getString("Status")); UpgradeData chunkconverter = nbt.contains("UpgradeData", 10) ? new UpgradeData(nbt.getCompound("UpgradeData"), world) : UpgradeData.EMPTY; @@ -33310,7 +33298,7 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..eb8f5d2efe7c32ddda4763e2ebe06530 DataResult dataresult; Logger logger; BlendingData.Packed blendingdata_d; -@@ -208,7 +208,7 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun +@@ -209,7 +209,7 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun Codec>> codec = makeBiomeCodecRW(iregistry); // CraftBukkit - read/write for (int i1 = 0; i1 < nbttaglist2.size(); ++i1) { @@ -33319,7 +33307,7 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..eb8f5d2efe7c32ddda4763e2ebe06530 byte b0 = nbttagcompound3.getByte("Y"); LevelChunkSection chunksection; -@@ -241,7 +241,17 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun +@@ -246,7 +246,17 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun DataLayer nibblearray = nbttagcompound3.contains("BlockLight", 7) ? new DataLayer(nbttagcompound3.getByteArray("BlockLight")) : null; DataLayer nibblearray1 = nbttagcompound3.contains("SkyLight", 7) ? new DataLayer(nbttagcompound3.getByteArray("SkyLight")) : null; @@ -33338,7 +33326,7 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..eb8f5d2efe7c32ddda4763e2ebe06530 } // CraftBukkit - ChunkBukkitValues -@@ -249,6 +259,47 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun +@@ -254,6 +264,47 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun } } @@ -33386,7 +33374,7 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..eb8f5d2efe7c32ddda4763e2ebe06530 public ProtoChunk read(ServerLevel world, PoiManager poiStorage, RegionStorageInfo key, ChunkPos expectedPos) { if (!Objects.equals(expectedPos, this.chunkPos)) { SerializableChunkData.LOGGER.error("Chunk file at {} is in the wrong location; relocating. (Expected {}, got {})", new Object[]{expectedPos, expectedPos, this.chunkPos}); -@@ -270,7 +321,7 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun +@@ -275,7 +326,7 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun if (serializablechunkdata_b.chunkSection != null) { achunksection[world.getSectionIndexFromSectionY(serializablechunkdata_b.y)] = serializablechunkdata_b.chunkSection; @@ -33395,7 +33383,7 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..eb8f5d2efe7c32ddda4763e2ebe06530 } boolean flag2 = serializablechunkdata_b.blockLight != null; -@@ -347,7 +398,7 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun +@@ -352,7 +403,7 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun } if (chunktype == ChunkType.LEVELCHUNK) { @@ -33404,7 +33392,7 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..eb8f5d2efe7c32ddda4763e2ebe06530 } else { ProtoChunk protochunk1 = (ProtoChunk) object; Iterator iterator2 = this.entities.iterator(); -@@ -377,7 +428,7 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun +@@ -382,7 +433,7 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun protochunk1.setCarvingMask(new CarvingMask(this.carvingMask, ((ChunkAccess) object).getMinY())); } @@ -33413,7 +33401,7 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..eb8f5d2efe7c32ddda4763e2ebe06530 } } -@@ -400,24 +451,48 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun +@@ -405,24 +456,48 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun throw new IllegalArgumentException("Chunk can't be serialized: " + String.valueOf(chunk)); } else { ChunkPos chunkcoordintpair = chunk.getPos(); @@ -33473,7 +33461,7 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..eb8f5d2efe7c32ddda4763e2ebe06530 List list1 = new ArrayList(chunk.getBlockEntitiesPos().size()); Iterator iterator = chunk.getBlockEntitiesPos().iterator(); -@@ -516,8 +591,8 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun +@@ -521,8 +596,8 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun Iterator iterator = this.sectionData.iterator(); while (iterator.hasNext()) { @@ -33484,7 +33472,7 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..eb8f5d2efe7c32ddda4763e2ebe06530 LevelChunkSection chunksection = serializablechunkdata_b.chunkSection; if (chunksection != null) { -@@ -533,6 +608,19 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun +@@ -538,6 +613,19 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun nbttagcompound1.putByteArray("SkyLight", serializablechunkdata_b.skyLight.getData()); } @@ -33504,7 +33492,7 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..eb8f5d2efe7c32ddda4763e2ebe06530 if (!nbttagcompound1.isEmpty()) { nbttagcompound1.putByte("Y", (byte) serializablechunkdata_b.y); nbttaglist.add(nbttagcompound1); -@@ -572,6 +660,14 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun +@@ -577,6 +665,14 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun nbttagcompound.put("ChunkBukkitValues", this.persistentDataContainer); } // CraftBukkit end @@ -33519,7 +33507,7 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..eb8f5d2efe7c32ddda4763e2ebe06530 return nbttagcompound; } -@@ -758,7 +854,67 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun +@@ -763,7 +859,67 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun return nbttaglist; } @@ -33674,7 +33662,7 @@ index 74a285b8b018a9c94ccea519f1ce8b9e2ef3cb64..d8b4196adf955f8d414688dc451caac2 } } diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -index 44e64d716eee71492f9a8d813934bb96463ece45..d52fcb82fdeab5b2e95b97a876c6e6701f569013 100644 +index 1fcc2b287ed723cf51720f80e68f18f4a15cf429..3f39d6c786d9dfdd9ad591e08ff05fcbb41a1df6 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java @@ -86,7 +86,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { @@ -34535,7 +34523,7 @@ index 7ec02a7849437a18860aa0df7d9ddd71b2447d4c..5e45e49ab09344cb95736f4124b1c6e0 public OffsetDoubleList(DoubleList oldList, double offset) { this.delegate = oldList; diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -index 5a0b0b47da3d796c391ac15eb573af25a1dfcd32..513bed7f11aee667c87046db4cf912b80e8f3638 100644 +index 76d7435e6fe81a3f1d24b35eae72d06232a1792b..ca3a2419252721bb3b3b719eb19afb5f175394c0 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java +++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java @@ -16,9 +16,15 @@ public final class Shapes { @@ -35941,7 +35929,7 @@ index 26620c06d26a2c0eb957fbadc6ac3d7a309bff46..3858c83c58e78435a6e29de84c33faa2 for (SavedTick savedTick : this.pendingTicks) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 5fc9e8e969debb3e15ed474b36a1c48b086d0449..47424d897ba706bc5f80ab563de130c873ccff2f 100644 +index f65cc95ab28e8a3b21eac2b16bd9ebe97e56e571..0074bc0e7147dc3a8c538e796f14ac9bf8725896 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -82,6 +82,12 @@ public class CraftChunk implements Chunk { @@ -36021,7 +36009,7 @@ index 5fc9e8e969debb3e15ed474b36a1c48b086d0449..47424d897ba706bc5f80ab563de130c8 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 6235d7caede85f4cf21dadde18d8080004672349..bfa2fc2e1ca9b68f5bf8b2e1ba6db4692ef4f73e 100644 +index 8348ab336029848eab1cbe9b67b056abf1f5866f..a34e40e273a79a234c3d79b6ad360ce3a4d35ba3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1421,7 +1421,7 @@ public final class CraftServer implements Server { @@ -36052,10 +36040,10 @@ index 6235d7caede85f4cf21dadde18d8080004672349..bfa2fc2e1ca9b68f5bf8b2e1ba6db469 // Paper start - Adventure diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 149377347fc632358a8bb97e644b1c4ab9be413d..2cef4788cce4467ba87d7982dbc559215917bce0 100644 +index b2eb8cf1de3b4b81587531bb4c0d4b512f5d5d5d..d4800a19d91562d6c55ac9bc5ed33a2c0de5a34f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -467,10 +467,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -508,10 +508,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z)); if (playerChunk == null) return false; @@ -36071,11 +36059,11 @@ index 149377347fc632358a8bb97e644b1c4ab9be413d..2cef4788cce4467ba87d7982dbc55921 - if (playersInRange.isEmpty()) return; + if (playersInRange.isEmpty()) return true; // Paper - chunk system - ClientboundLevelChunkWithLightPacket refreshPacket = new ClientboundLevelChunkWithLightPacket(chunk, this.world.getLightEngine(), null, null); - for (ServerPlayer player : playersInRange) { -@@ -478,8 +482,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { - - player.connection.send(refreshPacket); + // Paper start - Anti-Xray bypass + final Map refreshPackets = new HashMap<>(); +@@ -524,8 +528,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { + })); + // Paper end - Anti-Xray bypass } - }); - }); @@ -36083,7 +36071,7 @@ index 149377347fc632358a8bb97e644b1c4ab9be413d..2cef4788cce4467ba87d7982dbc55921 return true; } -@@ -583,20 +586,8 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -629,20 +632,8 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public Collection getPluginChunkTickets(int x, int z) { DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager; @@ -36105,7 +36093,7 @@ index 149377347fc632358a8bb97e644b1c4ab9be413d..2cef4788cce4467ba87d7982dbc55921 } @Override -@@ -604,7 +595,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -650,7 +641,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { Map> ret = new HashMap<>(); DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager; @@ -36114,7 +36102,7 @@ index 149377347fc632358a8bb97e644b1c4ab9be413d..2cef4788cce4467ba87d7982dbc55921 long chunkKey = chunkTickets.getLongKey(); SortedArraySet> tickets = chunkTickets.getValue(); -@@ -1307,12 +1298,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1353,12 +1344,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public int getViewDistance() { @@ -36129,7 +36117,7 @@ index 149377347fc632358a8bb97e644b1c4ab9be413d..2cef4788cce4467ba87d7982dbc55921 } public BlockMetadataStore getBlockMetadata() { -@@ -2453,17 +2444,20 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2496,17 +2487,20 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void setSimulationDistance(final int simulationDistance) { @@ -36154,10 +36142,10 @@ index 149377347fc632358a8bb97e644b1c4ab9be413d..2cef4788cce4467ba87d7982dbc55921 // Paper start - implement pointers diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 8d16575c74b81ada4e4efe70e8f077f07cd0a3f0..d010e34543474fe5d108b2e862041c5921ab97dd 100644 +index d5dc7ecb9c4dddfd2c92d89b27c15512a0822b08..ed29e06422aa5e73adfaf9578cda3dfc5777f64c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -3523,7 +3523,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3531,7 +3531,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setViewDistance(final int viewDistance) { @@ -36168,7 +36156,7 @@ index 8d16575c74b81ada4e4efe70e8f077f07cd0a3f0..d010e34543474fe5d108b2e862041c59 } @Override -@@ -3533,7 +3535,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3541,7 +3543,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setSimulationDistance(final int simulationDistance) { @@ -36179,7 +36167,7 @@ index 8d16575c74b81ada4e4efe70e8f077f07cd0a3f0..d010e34543474fe5d108b2e862041c59 } @Override -@@ -3543,6 +3547,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3551,7 +3555,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setSendViewDistance(final int viewDistance) { @@ -36188,7 +36176,8 @@ index 8d16575c74b81ada4e4efe70e8f077f07cd0a3f0..d010e34543474fe5d108b2e862041c59 + ((ca.spottedleaf.moonrise.patches.chunk_system.player.ChunkSystemServerPlayer)this.getHandle()) + .moonrise$getViewDistanceHolder().setSendViewDistance(viewDistance); } - } + + // Paper start - entity effect API diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java index 625562a38bc78feae3ae4b50b9afefbd05ff767a..e34060c21755c61228ba91e468b7c92fc4c4cf0c 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java diff --git a/patches/server/2979-fixup-Timings-v2.patch b/patches/server/2979-fixup-Timings-v2.patch deleted file mode 100644 index f2b8af09f4..0000000000 --- a/patches/server/2979-fixup-Timings-v2.patch +++ /dev/null @@ -1,18 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Thu, 24 Oct 2024 11:17:10 -0700 -Subject: [PATCH] fixup! Timings v2 - - -diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 7e5714fea4cda68b9ae21031c0e0d39061b07e2f..350bfa9c891130b1aa2ab973e86668de187ee1e0 100644 ---- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java -+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -427,7 +427,6 @@ public class ServerChunkCache extends ChunkSource { - gameprofilerfiller.pop(); - this.clearCache(); - } -- if (this.level.getServer().tickRateManager().runsNormally()) this.level.timings.chunkTicks.startTiming(); // Paper - - private void tickChunks() { - long i = this.level.getGameTime();