diff --git a/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch b/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch index 86aae0a3aa..f60b161c86 100644 --- a/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch +++ b/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch @@ -9,7 +9,7 @@ This should hopefully avoid duplicate entities ever being created if the entity was to end up in 2 different chunk slices diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 195cde784b..575ddcb2a0 100644 +index 195cde784b..82abe2a914 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk { @@ -21,13 +21,14 @@ index 195cde784b..575ddcb2a0 100644 // Paper start + List entitySlice = this.entitySlices[k]; + boolean inThis = entitySlice.contains(entity); -+ if (entity.entitySlice != null || inThis) { -+ if (entity.entitySlice == entitySlice || inThis) { -+ LogManager.getLogger().warn(entity + " was already in this chunk section! Report this to https://github.com/PaperMC/Paper/issues/1223"); ++ List currentSlice = entity.entitySlice; ++ if ((currentSlice != null && currentSlice.contains(entity)) || inThis) { ++ if (currentSlice == entitySlice || inThis) { ++ LogManager.getLogger().warn(entity + " was already in this chunk section! Report this to https://github.com/PaperMC/Paper/issues/1302"); + new Throwable().printStackTrace(); + return; + } else { -+ LogManager.getLogger().warn(entity + " is still in another ChunkSection! Report this to https://github.com/PaperMC/Paper/issues/1223"); ++ LogManager.getLogger().warn(entity + " is still in another ChunkSection! Report this to https://github.com/PaperMC/Paper/issues/1302"); + + Chunk chunk = entity.getCurrentChunk(); + if (chunk != null) { @@ -48,18 +49,18 @@ index 195cde784b..575ddcb2a0 100644 entity.setCurrentChunk(this); entityCounts.increment(entity.getMinecraftKeyString()); @@ -0,0 +0,0 @@ public class Chunk { + } // Paper start - if (!this.entitySlices[i].remove(entity)) { return; } + if (entitySlices[i] == entity.entitySlice) { + entity.entitySlice = null; + } else { -+ LogManager.getLogger().warn(entity + " was removed from a entitySlice we did not expect. Report this to https://github.com/PaperMC/Paper/issues/1223"); ++ LogManager.getLogger().warn(entity + " was removed from a entitySlice we did not expect. Report this to https://github.com/PaperMC/Paper/issues/1302"); + new Throwable().printStackTrace(); + } + if (!this.entitySlices[i].remove(entity)) { return; } this.markDirty(); entity.setCurrentChunk(null); - entityCounts.decrement(entity.getMinecraftKeyString()); @@ -0,0 +0,0 @@ public class Chunk { } // Spigot End @@ -69,14 +70,14 @@ index 195cde784b..575ddcb2a0 100644 // Do not pass along players, as doing so can get them stuck outside of time. // (which for example disables inventory icon updates and prevents block breaking) diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index eb8904a728..1e64d5fcd6 100644 +index eb8904a728..86b0b84335 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper } } }; -+ Object entitySlice = null; ++ List entitySlice = null; // Paper end static boolean isLevelAtLeast(NBTTagCompound tag, int level) { return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; diff --git a/Spigot-Server-Patches/Entity-add-to-world-fixes.patch b/Spigot-Server-Patches/Entity-add-to-world-fixes.patch index 06e3574ab7..28e7f564e9 100644 --- a/Spigot-Server-Patches/Entity-add-to-world-fixes.patch +++ b/Spigot-Server-Patches/Entity-add-to-world-fixes.patch @@ -14,7 +14,7 @@ Fix this by differing entity add to world for all entities at the same time the original entity is dead, overwrite it as the logic does for unloaod queued entities. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 575ddcb2a0..3d512d7595 100644 +index 82abe2a914..f618e8f628 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk { @@ -41,7 +41,7 @@ index 575ddcb2a0..3d512d7595 100644 } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 2ad7c75d2b..c04a9d5a09 100644 +index 4a16f7ac71..04d0fa1df9 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {