From 419ae0e668178620b3cd172416630ab2dd8b9bc1 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sat, 19 Oct 2019 09:14:26 +0100 Subject: [PATCH] Fire EntityRemovedFromWorldEvent for all entities (Fixes #2282) --- ...Entity-AddTo-RemoveFrom-World-Events.patch | 21 ++++++++++--------- ...Remove-unused-World-Tile-Entity-List.patch | 8 +++---- ...ld.spawnParticle-API-and-add-Builder.patch | 6 +++--- ...ead-Entities-in-entityList-iteration.patch | 6 +++--- ...ets-from-world-player-list-not-serve.patch | 8 +++---- ...mit-lightning-strike-effect-distance.patch | 6 +++--- ...le-Keep-Spawn-Loaded-range-per-world.patch | 6 +++--- ...-being-ticked-when-notifying-navigat.patch | 8 +++---- 8 files changed, 35 insertions(+), 34 deletions(-) diff --git a/Spigot-Server-Patches/0075-Entity-AddTo-RemoveFrom-World-Events.patch b/Spigot-Server-Patches/0075-Entity-AddTo-RemoveFrom-World-Events.patch index 1f4a3aa32f..3eee5100c2 100644 --- a/Spigot-Server-Patches/0075-Entity-AddTo-RemoveFrom-World-Events.patch +++ b/Spigot-Server-Patches/0075-Entity-AddTo-RemoveFrom-World-Events.patch @@ -1,13 +1,22 @@ -From b0480963f5822a8ad1c6d4a849c1d276b47188f9 Mon Sep 17 00:00:00 2001 +From b5102f4d7cba9a8db55efeaf0e9cacbf0b7357bc Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 28 Mar 2016 20:32:58 -0400 Subject: [PATCH] Entity AddTo/RemoveFrom World Events diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 559dee777..bd5b16299 100644 +index 559dee777..00b1f21f7 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -1121,7 +1121,7 @@ public class WorldServer extends World { + if (entity instanceof EntityInsentient) { + this.H.remove(((EntityInsentient) entity).getNavigation()); + } +- ++ new com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid + entity.valid = false; // CraftBukkit + } + @@ -1159,6 +1159,7 @@ public class WorldServer extends World { entity.origin = entity.getBukkitEntity().getLocation(); } @@ -16,14 +25,6 @@ index 559dee777..bd5b16299 100644 } } -@@ -1167,6 +1168,7 @@ public class WorldServer extends World { - if (this.tickingEntities) { - throw new IllegalStateException("Removing entity while ticking!"); - } else { -+ new com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid - this.removeEntityFromChunk(entity); - this.entitiesById.remove(entity.getId()); - this.unregisterEntity(entity); -- 2.23.0 diff --git a/Spigot-Server-Patches/0089-Remove-unused-World-Tile-Entity-List.patch b/Spigot-Server-Patches/0089-Remove-unused-World-Tile-Entity-List.patch index 651fa05ae5..a7891c2b3a 100644 --- a/Spigot-Server-Patches/0089-Remove-unused-World-Tile-Entity-List.patch +++ b/Spigot-Server-Patches/0089-Remove-unused-World-Tile-Entity-List.patch @@ -1,4 +1,4 @@ -From 0fa2dda6d19b2fe04dd585434caf274e0fec8485 Mon Sep 17 00:00:00 2001 +From 1cb90c9495b0cf6d32c6ef54bc903254dc6e868d Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 13 Apr 2016 00:25:28 -0400 Subject: [PATCH] Remove unused World Tile Entity List @@ -67,10 +67,10 @@ index 07d150586..ebeb48f6d 100644 } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index bd5b16299..caa281087 100644 +index 00b1f21f7..f9398af90 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1608,7 +1608,7 @@ public class WorldServer extends World { +@@ -1607,7 +1607,7 @@ public class WorldServer extends World { } bufferedwriter.write(String.format("entities: %d\n", this.entitiesById.size())); @@ -79,7 +79,7 @@ index bd5b16299..caa281087 100644 bufferedwriter.write(String.format("block_ticks: %d\n", this.getBlockTickList().a())); bufferedwriter.write(String.format("fluid_ticks: %d\n", this.getFluidTickList().a())); bufferedwriter.write("distance_manager: " + playerchunkmap.e().c() + "\n"); -@@ -1771,7 +1771,7 @@ public class WorldServer extends World { +@@ -1770,7 +1770,7 @@ public class WorldServer extends World { private void a(Writer writer) throws IOException { CSVWriter csvwriter = CSVWriter.a().a("x").a("y").a("z").a("type").a(writer); diff --git a/Spigot-Server-Patches/0222-Expand-World.spawnParticle-API-and-add-Builder.patch b/Spigot-Server-Patches/0222-Expand-World.spawnParticle-API-and-add-Builder.patch index 1780aa42ef..a4b2e43e4f 100644 --- a/Spigot-Server-Patches/0222-Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/Spigot-Server-Patches/0222-Expand-World.spawnParticle-API-and-add-Builder.patch @@ -1,4 +1,4 @@ -From 1e9bc6828cf9705c2fcf99b2efe642f748d0431b Mon Sep 17 00:00:00 2001 +From 4d5c45c92d173a5b81f4304e5f4be3910499c7f1 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 15 Aug 2017 22:29:12 -0400 Subject: [PATCH] Expand World.spawnParticle API and add Builder @@ -10,7 +10,7 @@ Adds an option to control the force mode of the particle. This adds a new Builder API which is much friendlier to use. diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 5d529fccf..a7a6e01d2 100644 +index 6c02e7782..86470d9b9 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -53,7 +53,7 @@ public class WorldServer extends World { @@ -22,7 +22,7 @@ index 5d529fccf..a7a6e01d2 100644 boolean tickingEntities; private final MinecraftServer server; private final WorldNBTStorage dataManager; -@@ -1380,12 +1380,17 @@ public class WorldServer extends World { +@@ -1379,12 +1379,17 @@ public class WorldServer extends World { } public int sendParticles(EntityPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) { diff --git a/Spigot-Server-Patches/0268-Ignore-Dead-Entities-in-entityList-iteration.patch b/Spigot-Server-Patches/0268-Ignore-Dead-Entities-in-entityList-iteration.patch index 0524bcf2d2..3b01bdd1ec 100644 --- a/Spigot-Server-Patches/0268-Ignore-Dead-Entities-in-entityList-iteration.patch +++ b/Spigot-Server-Patches/0268-Ignore-Dead-Entities-in-entityList-iteration.patch @@ -1,4 +1,4 @@ -From e88f08e087f4fe66ef5fcf542e2c84dd9f48b27d Mon Sep 17 00:00:00 2001 +From dd8e96e8cbe2211dc726c31d5bc0e86689214b04 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 701090c11..7d579c119 100644 private float av; private float aw; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index c31fd30f9..b42c54f88 100644 +index 107a50011..9683b8708 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -883,7 +883,7 @@ public class WorldServer extends World { @@ -83,7 +83,7 @@ index c31fd30f9..b42c54f88 100644 new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid } -@@ -1215,6 +1216,7 @@ public class WorldServer extends World { +@@ -1214,6 +1215,7 @@ public class WorldServer extends World { this.removeEntityFromChunk(entity); this.entitiesById.remove(entity.getId()); this.unregisterEntity(entity); diff --git a/Spigot-Server-Patches/0286-Send-nearby-packets-from-world-player-list-not-serve.patch b/Spigot-Server-Patches/0286-Send-nearby-packets-from-world-player-list-not-serve.patch index 41742e2baa..ea6d4c9365 100644 --- a/Spigot-Server-Patches/0286-Send-nearby-packets-from-world-player-list-not-serve.patch +++ b/Spigot-Server-Patches/0286-Send-nearby-packets-from-world-player-list-not-serve.patch @@ -1,4 +1,4 @@ -From 8a856cc87026c8b72521069dc318645e05215119 Mon Sep 17 00:00:00 2001 +From 7249b87fe4fdebfdcb3baaa2013a514b8ca09e5b 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 9e5cd22d7..049d702cb 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 b42c54f88..2b9cc25c4 100644 +index 9683b8708..21d2965a1 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1249,7 +1249,7 @@ public class WorldServer extends World { +@@ -1248,7 +1248,7 @@ public class WorldServer extends World { } // CraftBukkit end this.globalEntityList.add(entitylightning); @@ -58,7 +58,7 @@ index b42c54f88..2b9cc25c4 100644 } @Override -@@ -1381,7 +1381,7 @@ public class WorldServer extends World { +@@ -1380,7 +1380,7 @@ public class WorldServer extends World { BlockActionData blockactiondata = (BlockActionData) this.I.removeFirst(); if (this.a(blockactiondata)) { diff --git a/Spigot-Server-Patches/0322-Limit-lightning-strike-effect-distance.patch b/Spigot-Server-Patches/0322-Limit-lightning-strike-effect-distance.patch index 697e0354dd..1415b2c867 100644 --- a/Spigot-Server-Patches/0322-Limit-lightning-strike-effect-distance.patch +++ b/Spigot-Server-Patches/0322-Limit-lightning-strike-effect-distance.patch @@ -1,4 +1,4 @@ -From dad7e04cce8a0cf63ad22665cd881de2f1a3d89e Mon Sep 17 00:00:00 2001 +From 6ad660099cf2b56fd5e6f98ba2146563f0fa8d5c 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 2ceee79cf..27bf271bb 100644 --this.lifeTicks; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 2b9cc25c4..82e6defdd 100644 +index 21d2965a1..c9fe8074e 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1249,7 +1249,7 @@ public class WorldServer extends World { +@@ -1248,7 +1248,7 @@ public class WorldServer extends World { } // CraftBukkit end this.globalEntityList.add(entitylightning); diff --git a/Spigot-Server-Patches/0385-Configurable-Keep-Spawn-Loaded-range-per-world.patch b/Spigot-Server-Patches/0385-Configurable-Keep-Spawn-Loaded-range-per-world.patch index 0782e970c4..8a0fc441cd 100644 --- a/Spigot-Server-Patches/0385-Configurable-Keep-Spawn-Loaded-range-per-world.patch +++ b/Spigot-Server-Patches/0385-Configurable-Keep-Spawn-Loaded-range-per-world.patch @@ -1,4 +1,4 @@ -From e58a067b41ed196bf87ef1e5657a1d38542eaae8 Mon Sep 17 00:00:00 2001 +From 1cc52ceff74ca390385e08a4f78d0bba92cde07c 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 3f853e987..4068b90a2 100644 +index 891b89883..c9e018ac5 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1557,13 +1557,85 @@ public class WorldServer extends World { +@@ -1556,13 +1556,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/0401-Mark-entities-as-being-ticked-when-notifying-navigat.patch b/Spigot-Server-Patches/0401-Mark-entities-as-being-ticked-when-notifying-navigat.patch index 3dd76b1fe7..d07ddd89e7 100644 --- a/Spigot-Server-Patches/0401-Mark-entities-as-being-ticked-when-notifying-navigat.patch +++ b/Spigot-Server-Patches/0401-Mark-entities-as-being-ticked-when-notifying-navigat.patch @@ -1,14 +1,14 @@ -From 0d0dc5e3f5637821b9bd4812492cd88434c563ee Mon Sep 17 00:00:00 2001 +From 8fbef8cf5604a96d7211b7c5f76adc9f4f4bf782 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 9c688d80f..164fcdc46 100644 +index 7a575bc06..887775c99 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1369,6 +1369,7 @@ public class WorldServer extends World { +@@ -1368,6 +1368,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 9c688d80f..164fcdc46 100644 Iterator iterator = this.H.iterator(); while (iterator.hasNext()) { -@@ -1379,6 +1380,7 @@ public class WorldServer extends World { +@@ -1378,6 +1379,7 @@ public class WorldServer extends World { } }