3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00

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.
Dieser Commit ist enthalten in:
FearThe1337 2014-12-21 17:30:42 +01:00 committet von Thinkofdeath
Ursprung 2681166072
Commit b6634d7409

Datei anzeigen

@ -1,5 +1,5 @@
--- ../work/decompile-8eb82bde/net/minecraft/server/Entity.java 2014-12-12 11:04:49.470792233 +1100 --- ../work/decompile-8eb82bde//net/minecraft/server/Entity.java Sun Dec 21 17:29:15 2014
+++ src/main/java/net/minecraft/server/Entity.java 2014-12-12 11:03:57.000000000 +1100 +++ src/main/java/net/minecraft/server/Entity.java Sun Dec 21 17:29:15 2014
@@ -6,8 +6,40 @@ @@ -6,8 +6,40 @@
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
@ -331,12 +331,12 @@
+ } + }
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
+ // CraftBukkit start - Reset world + // CraftBukkit start - Reset world
+ if (this instanceof EntityPlayer) { + if (this instanceof EntityPlayer) {
+ Server server = Bukkit.getServer(); + Server server = Bukkit.getServer();
+ org.bukkit.World bworld = null; + org.bukkit.World bworld = null;
+
+ // TODO: Remove World related checks, replaced with WorldUID + // TODO: Remove World related checks, replaced with WorldUID
+ String worldName = nbttagcompound.getString("world"); + String worldName = nbttagcompound.getString("world");
+ +
@ -500,7 +500,7 @@
} }
} }
@@ -1546,32 +1861,78 @@ @@ -1546,32 +1861,82 @@
if (!this.world.isStatic && !this.dead) { if (!this.world.isStatic && !this.dead) {
this.world.methodProfiler.a("changeDimension"); this.world.methodProfiler.a("changeDimension");
MinecraftServer minecraftserver = MinecraftServer.getServer(); MinecraftServer minecraftserver = MinecraftServer.getServer();
@ -580,11 +580,15 @@
+ // CraftBukkit start - Forward the CraftEntity to the new entity + // CraftBukkit start - Forward the CraftEntity to the new entity
+ this.getBukkitEntity().setHandle(entity); + this.getBukkitEntity().setHandle(entity);
+ entity.bukkitEntity = this.getBukkitEntity(); + entity.bukkitEntity = this.getBukkitEntity();
+
+ if (this instanceof EntityInsentient) {
+ ((EntityInsentient)this).unleash(true, false); // Unleash to prevent duping of leads.
+ }
+ // CraftBukkit end + // CraftBukkit end
} }
this.dead = true; this.dead = true;
@@ -1680,8 +2041,27 @@ @@ -1680,8 +2045,27 @@
return this.boundingBox; return this.boundingBox;
} }