From bdcc31caadce04b45ffbcca0a50b571f687ef21a Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 12 Apr 2020 22:55:43 -0400 Subject: [PATCH] Let invalid positioned entities clean up previous chunk by the chunkCheck I had did a few of the operations myself, which would have broken chunkCheck from doing it itself, which would leave some state left in the original chunk and thats not good.... --- .../0261-Prevent-Saving-Bad-entities-to-chunks.patch | 9 +++------ ...63-Ignore-Dead-Entities-in-entityList-iteration.patch | 8 ++++---- ...nearby-packets-from-world-player-list-not-serve.patch | 8 ++++---- .../0313-Limit-lightning-strike-effect-distance.patch | 6 +++--- ...-Configurable-Keep-Spawn-Loaded-range-per-world.patch | 6 +++--- ...entities-as-being-ticked-when-notifying-navigat.patch | 8 ++++---- .../0450-Ensure-Entity-is-never-double-registered.patch | 8 ++++---- ...ix-unregistering-entities-from-unloading-chunks.patch | 6 +++--- ...vent-Double-PlayerChunkMap-adds-crashing-server.patch | 8 ++++---- 9 files changed, 32 insertions(+), 35 deletions(-) diff --git a/Spigot-Server-Patches/0261-Prevent-Saving-Bad-entities-to-chunks.patch b/Spigot-Server-Patches/0261-Prevent-Saving-Bad-entities-to-chunks.patch index a7f54da2f..a975cc10c 100644 --- a/Spigot-Server-Patches/0261-Prevent-Saving-Bad-entities-to-chunks.patch +++ b/Spigot-Server-Patches/0261-Prevent-Saving-Bad-entities-to-chunks.patch @@ -1,4 +1,4 @@ -From 3c6d8305c8007d43baa346e7509fa87793f59c1d Mon Sep 17 00:00:00 2001 +From ac56ad751d4d82d4212eabc7f6dcdbc47b857bb7 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 26 Jul 2018 00:11:12 -0400 Subject: [PATCH] Prevent Saving Bad entities to chunks @@ -80,7 +80,7 @@ index 4af5a230b..83bcef7e6 100644 public static ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) { if (nbttagcompound != null) { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 6ce7f77a5..1adabb751 100644 +index 6ce7f77a5..87762b172 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -1085,6 +1085,7 @@ public class WorldServer extends World { @@ -91,16 +91,13 @@ index 6ce7f77a5..1adabb751 100644 for (int j = 0; j < i; ++j) { List entityslice = aentityslice[j]; // Spigot Iterator iterator = entityslice.iterator(); -@@ -1109,11 +1110,28 @@ public class WorldServer extends World { +@@ -1109,11 +1110,25 @@ public class WorldServer extends World { throw (IllegalStateException) SystemUtils.c(new IllegalStateException("Removing entity while ticking!")); } + // Paper start - move out entities that shouldn't be in this chunk before it unloads + if (!entity.dead && (int) Math.floor(entity.locX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.locZ()) >> 4 != chunk.getPos().z) { + toMoveChunks.add(entity); -+ entity.inChunk = false; -+ entity.entitySlice = null; -+ iterator.remove(); + continue; + } + // Paper end diff --git a/Spigot-Server-Patches/0263-Ignore-Dead-Entities-in-entityList-iteration.patch b/Spigot-Server-Patches/0263-Ignore-Dead-Entities-in-entityList-iteration.patch index c746afce6..2174c7cc0 100644 --- a/Spigot-Server-Patches/0263-Ignore-Dead-Entities-in-entityList-iteration.patch +++ b/Spigot-Server-Patches/0263-Ignore-Dead-Entities-in-entityList-iteration.patch @@ -1,4 +1,4 @@ -From d74308ea9718ce70c654463ae2cbc74e8dbad111 Mon Sep 17 00:00:00 2001 +From b272e3ed56fcdff15a2ffd879ea937079936102e Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 28 Jul 2018 12:18:27 -0400 Subject: [PATCH] Ignore Dead Entities in entityList iteration @@ -63,7 +63,7 @@ index 356de07da..33cd7f7b4 100644 public float getBukkitYaw() { return this.yaw; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 1adabb751..56de91008 100644 +index 87762b172..8d292604c 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -908,7 +908,7 @@ public class WorldServer extends World { @@ -75,7 +75,7 @@ index 1adabb751..56de91008 100644 if (entity instanceof EntityInsentient) { EntityInsentient entityinsentient = (EntityInsentient) entity; -@@ -1247,6 +1247,7 @@ public class WorldServer extends World { +@@ -1244,6 +1244,7 @@ public class WorldServer extends World { entity.origin = entity.getBukkitEntity().getLocation(); } // Paper end @@ -83,7 +83,7 @@ index 1adabb751..56de91008 100644 new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid } -@@ -1259,6 +1260,7 @@ public class WorldServer extends World { +@@ -1256,6 +1257,7 @@ public class WorldServer extends World { this.removeEntityFromChunk(entity); this.entitiesById.remove(entity.getId()); this.unregisterEntity(entity); diff --git a/Spigot-Server-Patches/0278-Send-nearby-packets-from-world-player-list-not-serve.patch b/Spigot-Server-Patches/0278-Send-nearby-packets-from-world-player-list-not-serve.patch index b8526d42c..e753b46d8 100644 --- a/Spigot-Server-Patches/0278-Send-nearby-packets-from-world-player-list-not-serve.patch +++ b/Spigot-Server-Patches/0278-Send-nearby-packets-from-world-player-list-not-serve.patch @@ -1,4 +1,4 @@ -From 902e2759616eb41c26ad90bc2efd0358719e4338 Mon Sep 17 00:00:00 2001 +From 8664a8652bac4d62e50a42117d2f61c4caa5ece8 Mon Sep 17 00:00:00 2001 From: Mystiflow Date: Fri, 6 Jul 2018 13:21:30 +0100 Subject: [PATCH] Send nearby packets from world player list not server list @@ -46,10 +46,10 @@ index 442673b13..36d31d271 100644 double d5 = d1 - entityplayer.locY(); double d6 = d2 - entityplayer.locZ(); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 56de91008..3f74a34d8 100644 +index 8d292604c..09176e604 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1293,7 +1293,7 @@ public class WorldServer extends World { +@@ -1290,7 +1290,7 @@ public class WorldServer extends World { } // CraftBukkit end this.globalEntityList.add(entitylightning); @@ -58,7 +58,7 @@ index 56de91008..3f74a34d8 100644 } @Override -@@ -1425,7 +1425,7 @@ public class WorldServer extends World { +@@ -1422,7 +1422,7 @@ public class WorldServer extends World { BlockActionData blockactiondata = (BlockActionData) this.I.removeFirst(); if (this.a(blockactiondata)) { diff --git a/Spigot-Server-Patches/0313-Limit-lightning-strike-effect-distance.patch b/Spigot-Server-Patches/0313-Limit-lightning-strike-effect-distance.patch index 9d8932a61..579739801 100644 --- a/Spigot-Server-Patches/0313-Limit-lightning-strike-effect-distance.patch +++ b/Spigot-Server-Patches/0313-Limit-lightning-strike-effect-distance.patch @@ -1,4 +1,4 @@ -From 04983f017e812190f1de29ef50612ee72715fe65 Mon Sep 17 00:00:00 2001 +From 7aa6bb5c04a2ef405ebf63c82a6fc3e1e5698227 Mon Sep 17 00:00:00 2001 From: Trigary Date: Fri, 14 Sep 2018 17:42:08 +0200 Subject: [PATCH] Limit lightning strike effect distance @@ -69,10 +69,10 @@ index 7c518983a..bdb534deb 100644 --this.lifeTicks; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 3f74a34d8..577043c74 100644 +index 09176e604..43565dd92 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1293,7 +1293,7 @@ public class WorldServer extends World { +@@ -1290,7 +1290,7 @@ public class WorldServer extends World { } // CraftBukkit end this.globalEntityList.add(entitylightning); diff --git a/Spigot-Server-Patches/0373-Configurable-Keep-Spawn-Loaded-range-per-world.patch b/Spigot-Server-Patches/0373-Configurable-Keep-Spawn-Loaded-range-per-world.patch index 6ad130f95..8f33a5b00 100644 --- a/Spigot-Server-Patches/0373-Configurable-Keep-Spawn-Loaded-range-per-world.patch +++ b/Spigot-Server-Patches/0373-Configurable-Keep-Spawn-Loaded-range-per-world.patch @@ -1,4 +1,4 @@ -From 3d4c6a9cd4766057fcd6db19f504cba07be956f2 Mon Sep 17 00:00:00 2001 +From 0539b98a44e4593da8c672e58037072c528f4b33 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 13 Sep 2014 23:14:43 -0400 Subject: [PATCH] Configurable Keep Spawn Loaded range per world @@ -114,10 +114,10 @@ index 3868572ae..ae77805f7 100644 @Override public void a(ChunkCoordIntPair chunkcoordintpair) { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index fa7709122..0cba585cf 100644 +index f9ee9afe3..f9c14b9a9 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1601,13 +1601,85 @@ public class WorldServer extends World { +@@ -1598,13 +1598,85 @@ public class WorldServer extends World { return ((PersistentIdCounts) this.getMinecraftServer().getWorldServer(DimensionManager.OVERWORLD).getWorldPersistentData().a(PersistentIdCounts::new, "idcounts")).a(); } diff --git a/Spigot-Server-Patches/0388-Mark-entities-as-being-ticked-when-notifying-navigat.patch b/Spigot-Server-Patches/0388-Mark-entities-as-being-ticked-when-notifying-navigat.patch index 562bce05c..a03678e90 100644 --- a/Spigot-Server-Patches/0388-Mark-entities-as-being-ticked-when-notifying-navigat.patch +++ b/Spigot-Server-Patches/0388-Mark-entities-as-being-ticked-when-notifying-navigat.patch @@ -1,14 +1,14 @@ -From 76bab2d2d7f1f05de240733c82fab37dbc60d0e6 Mon Sep 17 00:00:00 2001 +From 4017cfdb78a0758a5b0310724c0d3eab3be0cc99 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sun, 28 Jul 2019 00:51:11 +0100 Subject: [PATCH] Mark entities as being ticked when notifying navigation diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 2287453b7..4ddd8fd04 100644 +index 00379f0a6..a79ccad0b 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1415,6 +1415,7 @@ public class WorldServer extends World { +@@ -1412,6 +1412,7 @@ public class WorldServer extends World { VoxelShape voxelshape1 = iblockdata1.getCollisionShape(this, blockposition); if (VoxelShapes.c(voxelshape, voxelshape1, OperatorBoolean.NOT_SAME)) { @@ -16,7 +16,7 @@ index 2287453b7..4ddd8fd04 100644 Iterator iterator = this.navigators.iterator(); while (iterator.hasNext()) { -@@ -1425,6 +1426,7 @@ public class WorldServer extends World { +@@ -1422,6 +1423,7 @@ public class WorldServer extends World { } } diff --git a/Spigot-Server-Patches/0450-Ensure-Entity-is-never-double-registered.patch b/Spigot-Server-Patches/0450-Ensure-Entity-is-never-double-registered.patch index b4fb8240c..fc6e20483 100644 --- a/Spigot-Server-Patches/0450-Ensure-Entity-is-never-double-registered.patch +++ b/Spigot-Server-Patches/0450-Ensure-Entity-is-never-double-registered.patch @@ -1,4 +1,4 @@ -From c28915808450a2ec9173915f0f47a0cebcbbe6a5 Mon Sep 17 00:00:00 2001 +From 175f1aa581f5c3bd0f35201fcf5a5429da491b8a 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,7 +23,7 @@ index 16f2e32d2..9cb4e5a1e 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 5b644db97..ed6599ca1 100644 +index 779da0650..a4f34293f 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -520,6 +520,7 @@ public class WorldServer extends World { @@ -34,7 +34,7 @@ index 5b644db97..ed6599ca1 100644 this.registerEntity(entity); } } // Paper - timings -@@ -1347,6 +1348,19 @@ public class WorldServer extends World { +@@ -1344,6 +1345,19 @@ public class WorldServer extends World { public void unregisterEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity unregister"); // Spigot @@ -54,7 +54,7 @@ index 5b644db97..ed6599ca1 100644 // Spigot start if ( entity instanceof EntityHuman ) { -@@ -1408,9 +1422,21 @@ public class WorldServer extends World { +@@ -1405,9 +1419,21 @@ public class WorldServer extends World { private void registerEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot diff --git a/Spigot-Server-Patches/0451-Fix-unregistering-entities-from-unloading-chunks.patch b/Spigot-Server-Patches/0451-Fix-unregistering-entities-from-unloading-chunks.patch index f20cbe53f..6cd6d49e8 100644 --- a/Spigot-Server-Patches/0451-Fix-unregistering-entities-from-unloading-chunks.patch +++ b/Spigot-Server-Patches/0451-Fix-unregistering-entities-from-unloading-chunks.patch @@ -1,4 +1,4 @@ -From 276cdbbff63e0ee0671b2f0a53178fca15e81647 Mon Sep 17 00:00:00 2001 +From 98db760202074db2a46203553e963cc97f3a4d1e 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 ed6599ca1..ce1075e5a 100644 +index a4f34293f..22e8eca96 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1501,9 +1501,9 @@ public class WorldServer extends World { +@@ -1498,9 +1498,9 @@ public class WorldServer extends World { } private void removeEntityFromChunk(Entity entity) { diff --git a/Spigot-Server-Patches/0454-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/Spigot-Server-Patches/0454-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index 35345560a..0f24ccb89 100644 --- a/Spigot-Server-Patches/0454-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/Spigot-Server-Patches/0454-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -1,4 +1,4 @@ -From 27cdad7a9321efaa5dc7ee8897bbf22086106b2d Mon Sep 17 00:00:00 2001 +From 2a83e08228511b66dd7351982268256bdc40ef46 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 2 Apr 2020 01:42:39 -0400 Subject: [PATCH] Prevent Double PlayerChunkMap adds crashing server @@ -26,10 +26,10 @@ index 0186ab9e4..e1e4ea793 100644 if (!(entity instanceof EntityLightning)) { EntityTypes entitytypes = entity.getEntityType(); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index ce1075e5a..6a5520ee2 100644 +index 22e8eca96..1f97e3f23 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1467,7 +1467,7 @@ public class WorldServer extends World { +@@ -1464,7 +1464,7 @@ public class WorldServer extends World { } } @@ -38,7 +38,7 @@ index ce1075e5a..6a5520ee2 100644 // CraftBukkit start - SPIGOT-5278 if (entity instanceof EntityDrowned) { this.navigators.add(((EntityDrowned) entity).navigationWater); -@@ -1478,6 +1478,7 @@ public class WorldServer extends World { +@@ -1475,6 +1475,7 @@ public class WorldServer extends World { this.navigators.add(((EntityInsentient) entity).getNavigation()); } entity.valid = true; // CraftBukkit