From c775246c69460745835550636d85736b96f26e70 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 20 Aug 2018 00:54:03 -0400 Subject: [PATCH] Fix false positive on Chunk Entity slice messages #1302 Update links too --- ...dd-some-Debug-to-Chunk-Entity-slices.patch | 29 ++++++++++--------- .../0348-Entity-add-to-world-fixes.patch | 10 +++---- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Spigot-Server-Patches/0340-Add-some-Debug-to-Chunk-Entity-slices.patch b/Spigot-Server-Patches/0340-Add-some-Debug-to-Chunk-Entity-slices.patch index 22c065571c..0fa501df11 100644 --- a/Spigot-Server-Patches/0340-Add-some-Debug-to-Chunk-Entity-slices.patch +++ b/Spigot-Server-Patches/0340-Add-some-Debug-to-Chunk-Entity-slices.patch @@ -1,4 +1,4 @@ -From e4d1385d484c0a847d796803128a541b22246000 Mon Sep 17 00:00:00 2001 +From 31831a472623f2197edb100298c024df40aa8458 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 23 Jul 2018 22:44:23 -0400 Subject: [PATCH] Add some Debug to Chunk Entity slices @@ -9,10 +9,10 @@ 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 -@@ -681,8 +681,33 @@ public class Chunk { +@@ -681,8 +681,34 @@ public class Chunk { entity.ab = this.locX; entity.ac = k; entity.ad = this.locZ; @@ -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) { @@ -47,20 +48,20 @@ index 195cde784b..575ddcb2a0 100644 this.markDirty(); entity.setCurrentChunk(this); entityCounts.increment(entity.getMinecraftKeyString()); -@@ -726,6 +751,12 @@ public class Chunk { +@@ -725,6 +751,12 @@ 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()); -@@ -954,6 +985,7 @@ public class Chunk { +@@ -954,6 +986,7 @@ public class Chunk { } // Spigot End entity.setCurrentChunk(null); // Paper @@ -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 @@ -59,6 +59,7 @@ 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/0348-Entity-add-to-world-fixes.patch b/Spigot-Server-Patches/0348-Entity-add-to-world-fixes.patch index eba70c38a9..036e2fbd87 100644 --- a/Spigot-Server-Patches/0348-Entity-add-to-world-fixes.patch +++ b/Spigot-Server-Patches/0348-Entity-add-to-world-fixes.patch @@ -1,4 +1,4 @@ -From 2a5ab03010c297502ce4c62084fbd321cd567634 Mon Sep 17 00:00:00 2001 +From 5bb574d9652dadb2b33f6a6a6c538a244f06af73 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 3 Aug 2018 22:47:46 -0400 Subject: [PATCH] Entity add to world fixes @@ -14,10 +14,10 @@ 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 -@@ -888,6 +888,7 @@ public class Chunk { +@@ -889,6 +889,7 @@ public class Chunk { this.world.b(this.tileEntities.values()); List[] aentityslice = this.entitySlices; // Spigot int i = aentityslice.length; @@ -25,7 +25,7 @@ index 575ddcb2a0..3d512d7595 100644 for (int j = 0; j < i; ++j) { List entityslice = aentityslice[j]; // Spigot -@@ -934,10 +935,12 @@ public class Chunk { +@@ -935,10 +936,12 @@ public class Chunk { thisChunk.put(entity.uniqueID, entity); } } @@ -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 @@ -1204,6 +1204,7 @@ public abstract class World implements IBlockAccess {