From 7dac546709dff648b9524d5949d771ceae56518a Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 31 Mar 2020 03:52:30 -0400 Subject: [PATCH] Fix bug in double register fix could accidently delay entity reg by a tick if the bug this was fixing was encountered --- ...Ensure-Entity-is-never-double-registered.patch | 15 +++++++-------- ...gistering-entities-from-unloading-chunks.patch | 6 +++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Spigot-Server-Patches/0452-Ensure-Entity-is-never-double-registered.patch b/Spigot-Server-Patches/0452-Ensure-Entity-is-never-double-registered.patch index 57f5ae1c6..58f4523cd 100644 --- a/Spigot-Server-Patches/0452-Ensure-Entity-is-never-double-registered.patch +++ b/Spigot-Server-Patches/0452-Ensure-Entity-is-never-double-registered.patch @@ -1,4 +1,4 @@ -From e4dec7b8e9738cefe23b9b032b0ec6fabdbbcc1b Mon Sep 17 00:00:00 2001 +From 679f8ee00e78b7de41adc180523cd8d6bcaa765f Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 29 Mar 2020 18:26:14 -0400 Subject: [PATCH] Ensure Entity is never double registered @@ -23,19 +23,18 @@ index 8da54c68cc..eb706f8636 100644 private boolean locked = false; @Override diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 5ba46fca55..9cb22eef56 100644 +index 5ba46fca55..23527809ce 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -519,7 +519,7 @@ public class WorldServer extends World { - this.tickingEntities = false; +@@ -520,6 +520,7 @@ public class WorldServer extends World { try (co.aikar.timings.Timing ignored = this.timings.newEntities.startTiming()) { // Paper - timings -- while ((entity = (Entity) this.entitiesToAdd.poll()) != null) { -+ while ((entity = (Entity) this.entitiesToAdd.poll()) != null && entity.isQueuedForRegister) { // Paper - ignore cancelled registers + while ((entity = (Entity) this.entitiesToAdd.poll()) != null) { ++ if (!entity.isQueuedForRegister) continue; // Paper - ignore cancelled registers this.registerEntity(entity); } } // Paper - timings -@@ -1329,6 +1329,19 @@ public class WorldServer extends World { +@@ -1329,6 +1330,19 @@ public class WorldServer extends World { public void unregisterEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity unregister"); // Spigot @@ -55,7 +54,7 @@ index 5ba46fca55..9cb22eef56 100644 // Spigot start if ( entity instanceof EntityHuman ) { -@@ -1390,9 +1403,21 @@ public class WorldServer extends World { +@@ -1390,9 +1404,21 @@ public class WorldServer extends World { private void registerEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot diff --git a/Spigot-Server-Patches/0453-Fix-unregistering-entities-from-unloading-chunks.patch b/Spigot-Server-Patches/0453-Fix-unregistering-entities-from-unloading-chunks.patch index a970b62a8..2a19d7a46 100644 --- a/Spigot-Server-Patches/0453-Fix-unregistering-entities-from-unloading-chunks.patch +++ b/Spigot-Server-Patches/0453-Fix-unregistering-entities-from-unloading-chunks.patch @@ -1,4 +1,4 @@ -From efaf7c2426c5bfd1970e5d9a01fb43d96ee1aab2 Mon Sep 17 00:00:00 2001 +From 48d61cf99938227f87cfb748e86a9e83c169bb55 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 31 Mar 2020 03:01:45 -0400 Subject: [PATCH] Fix unregistering entities from unloading chunks @@ -15,10 +15,10 @@ Combine that with a buggy detail of the previous implementation of the Dupe UUID patch, then this was the likely source of the "Ghost entities" diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 9cb22eef56..f7a9b58db3 100644 +index 23527809ce..941eee838b 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1482,9 +1482,9 @@ public class WorldServer extends World { +@@ -1483,9 +1483,9 @@ public class WorldServer extends World { } private void removeEntityFromChunk(Entity entity) {