diff --git a/paper-server/patches/sources/net/minecraft/world/level/chunk/UpgradeData.java.patch b/paper-server/patches/sources/net/minecraft/world/level/chunk/UpgradeData.java.patch new file mode 100644 index 0000000000..a822d43229 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/chunk/UpgradeData.java.patch @@ -0,0 +1,43 @@ +--- a/net/minecraft/world/level/chunk/UpgradeData.java ++++ b/net/minecraft/world/level/chunk/UpgradeData.java +@@ -109,9 +109,28 @@ + if (nbt.contains(key, 9)) { + for (Tag tag : nbt.getList(key, 10)) { + SavedTick.loadTick((CompoundTag)tag, nameToType).ifPresent(ticks::add); ++ } ++ } ++ } ++ ++ // Paper start - filter out relocated neighbour ticks ++ // The lists are only supposed to contain ticks for the 1 radius neighbours of the chunk ++ private static void filterTickList(int chunkX, int chunkZ, List> ticks) { ++ for (java.util.Iterator> iterator = ticks.iterator(); iterator.hasNext();) { ++ SavedTick tick = iterator.next(); ++ BlockPos tickPos = tick.pos(); ++ int tickCX = tickPos.getX() >> 4; ++ int tickCZ = tickPos.getZ() >> 4; ++ ++ int dist = Math.max(Math.abs(chunkX - tickCX), Math.abs(chunkZ - tickCZ)); ++ ++ if (dist != 1) { ++ LOGGER.warn("Neighbour tick '" + tick + "' serialized in chunk (" + chunkX + "," + chunkZ + ") is too far (" + tickCX + "," + tickCZ + ")"); ++ iterator.remove(); + } + } + } ++ // Paper end - filter out relocated neighbour ticks + + public void upgrade(LevelChunk chunk) { + this.upgradeInside(chunk); +@@ -120,6 +139,11 @@ + upgradeSides(chunk, direction8); + } + ++ // Paper start - filter out relocated neighbour ticks ++ filterTickList(chunk.locX, chunk.locZ, this.neighborBlockTicks); ++ filterTickList(chunk.locX, chunk.locZ, this.neighborFluidTicks); ++ // Paper end - filter out relocated neighbour ticks ++ + Level level = chunk.getLevel(); + this.neighborBlockTicks.forEach(tick -> { + Block block = tick.type() == Blocks.AIR ? level.getBlockState(tick.pos()).getBlock() : tick.type();