From 401641ea6d6cdcdd0edd2d212ec5a4cd61f7423d Mon Sep 17 00:00:00 2001 From: blablubbabc Date: Sat, 27 Apr 2019 09:25:38 +1000 Subject: [PATCH] SPIGOT-4774: Entities don't get marked 'invalid' after being removed --- nms-patches/WorldServer.patch | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch index 224256e5b6..4ad2df8abc 100644 --- a/nms-patches/WorldServer.patch +++ b/nms-patches/WorldServer.patch @@ -330,7 +330,15 @@ return true; } } -@@ -899,6 +1019,7 @@ +@@ -876,6 +996,7 @@ + this.I.remove(((EntityInsentient) entity).getNavigation()); + } + ++ entity.valid = false; // CraftBukkit + } + + private void registerEntity(Entity entity) { +@@ -899,6 +1020,7 @@ if (entity instanceof EntityInsentient) { this.I.add(((EntityInsentient) entity).getNavigation()); } @@ -338,7 +346,7 @@ } } -@@ -929,6 +1050,18 @@ +@@ -929,6 +1051,18 @@ } public void strikeLightning(EntityLightning entitylightning) { @@ -357,7 +365,7 @@ this.globalEntityList.add(entitylightning); this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX, entitylightning.locY, entitylightning.locZ, 512.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutSpawnEntityWeather(entitylightning)); } -@@ -937,6 +1070,12 @@ +@@ -937,6 +1071,12 @@ public void a(int i, BlockPosition blockposition, int j) { Iterator iterator = this.server.getPlayerList().getPlayers().iterator(); @@ -370,7 +378,7 @@ while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer) iterator.next(); -@@ -945,6 +1084,12 @@ +@@ -945,6 +1085,12 @@ double d1 = (double) blockposition.getY() - entityplayer.locY; double d2 = (double) blockposition.getZ() - entityplayer.locZ; @@ -383,7 +391,7 @@ if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) { entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j)); } -@@ -955,12 +1100,14 @@ +@@ -955,12 +1101,14 @@ @Override public void a(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, SoundEffect soundeffect, SoundCategory soundcategory, float f, float f1) { @@ -400,7 +408,7 @@ } @Override -@@ -970,7 +1117,8 @@ +@@ -970,7 +1118,8 @@ @Override public void a(@Nullable EntityHuman entityhuman, int i, BlockPosition blockposition, int j) { @@ -410,7 +418,7 @@ } @Override -@@ -1005,6 +1153,14 @@ +@@ -1005,6 +1154,14 @@ @Override public Explosion createExplosion(@Nullable Entity entity, DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) { @@ -425,7 +433,7 @@ Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, explosion_effect); if (damagesource != null) { -@@ -1013,6 +1169,8 @@ +@@ -1013,6 +1170,8 @@ explosion.a(); explosion.a(false); @@ -434,7 +442,7 @@ if (explosion_effect == Explosion.Effect.NONE) { explosion.clearBlocks(); } -@@ -1040,7 +1198,8 @@ +@@ -1040,7 +1199,8 @@ BlockActionData blockactiondata = (BlockActionData) this.J.removeFirst(); if (this.a(blockactiondata)) { @@ -444,7 +452,7 @@ } } -@@ -1083,13 +1242,20 @@ +@@ -1083,13 +1243,20 @@ } public int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) { @@ -467,7 +475,7 @@ ++j; } } -@@ -1172,7 +1338,13 @@ +@@ -1172,7 +1339,13 @@ @Override public WorldMap a(String s) { return (WorldMap) this.getMinecraftServer().getWorldServer(DimensionManager.OVERWORLD).getWorldPersistentData().b(() -> {