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.
This commit is contained in:
FearThe1337 2014-12-21 17:30:42 +01:00 committed by Thinkofdeath
parent 2681166072
commit b6634d7409

View File

@ -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;
}