From b6634d740973585499850325aa1288c17057f73e Mon Sep 17 00:00:00 2001 From: FearThe1337 Date: Sun, 21 Dec 2014 17:30:42 +0100 Subject: [PATCH] SPIGOT-241 - Fix the duplication glitch of Leads (Vanilla bug). Glitch is caused because entities drop their leads when they are dead and still leashed and when they can't find their owner (Or the distance is too large). We need to make sure the entity we set to be dead, loses its leash before the next tick, else there will be two dropped leads. --- nms-patches/Entity.patch | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/nms-patches/Entity.patch b/nms-patches/Entity.patch index 4356df0066..478fbbbbca 100644 --- a/nms-patches/Entity.patch +++ b/nms-patches/Entity.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/Entity.java 2014-12-12 11:04:49.470792233 +1100 -+++ src/main/java/net/minecraft/server/Entity.java 2014-12-12 11:03:57.000000000 +1100 +--- ../work/decompile-8eb82bde//net/minecraft/server/Entity.java Sun Dec 21 17:29:15 2014 ++++ src/main/java/net/minecraft/server/Entity.java Sun Dec 21 17:29:15 2014 @@ -6,8 +6,40 @@ import java.util.UUID; import java.util.concurrent.Callable; @@ -331,12 +331,12 @@ + } + } + // CraftBukkit end -+ + + // CraftBukkit start - Reset world + if (this instanceof EntityPlayer) { + Server server = Bukkit.getServer(); + org.bukkit.World bworld = null; - ++ + // TODO: Remove World related checks, replaced with WorldUID + String worldName = nbttagcompound.getString("world"); + @@ -500,7 +500,7 @@ } } -@@ -1546,32 +1861,78 @@ +@@ -1546,32 +1861,82 @@ if (!this.world.isStatic && !this.dead) { this.world.methodProfiler.a("changeDimension"); MinecraftServer minecraftserver = MinecraftServer.getServer(); @@ -580,11 +580,15 @@ + // CraftBukkit start - Forward the CraftEntity to the new entity + this.getBukkitEntity().setHandle(entity); + entity.bukkitEntity = this.getBukkitEntity(); ++ ++ if (this instanceof EntityInsentient) { ++ ((EntityInsentient)this).unleash(true, false); // Unleash to prevent duping of leads. ++ } + // CraftBukkit end } this.dead = true; -@@ -1680,8 +2041,27 @@ +@@ -1680,8 +2045,27 @@ return this.boundingBox; }