CavePVP-Stuff/cSpigot-master/spigot-server-Patches/0101-Fix-disappearing-leash...

59 lines
2.4 KiB
Diff
Raw Normal View History

2023-05-01 20:59:40 +02:00
From aa7fbe452bc1074c643b003164ae8960b216695a Mon Sep 17 00:00:00 2001
From: Poweruser_rs <poweruser.rs@hotmail.com>
Date: Wed, 4 Nov 2015 12:20:05 +0100
Subject: [PATCH] Fix disappearing leashes
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index e99156371..ccc86bbeb 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -234,6 +234,12 @@ public abstract class EntityInsentient extends EntityLiving {
nbttagcompound.set("Leash", nbttagcompound1);
}
+
+ // Poweruser start
+ else if(this.bx != null) {
+ nbttagcompound.set("Leash", this.bx);
+ }
+ // Poweruser end
}
public void a(NBTTagCompound nbttagcompound) {
@@ -894,11 +900,14 @@ public abstract class EntityInsentient extends EntityLiving {
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving.getUniqueID().equals(uuid)) {
- this.bw = entityliving;
+ this.setLeashHolder(entityliving, true); // Poweruser
break;
}
}
- } else if (this.bx.hasKeyOfType("X", 99) && this.bx.hasKeyOfType("Y", 99) && this.bx.hasKeyOfType("Z", 99)) {
+ // Poweruser start
+ }
+ if (this.bw == null && this.bx.hasKeyOfType("X", 99) && this.bx.hasKeyOfType("Y", 99) && this.bx.hasKeyOfType("Z", 99)) {
+ // Poweruser end
int i = this.bx.getInt("X");
int j = this.bx.getInt("Y");
int k = this.bx.getInt("Z");
@@ -907,9 +916,11 @@ public abstract class EntityInsentient extends EntityLiving {
if (entityleash == null) {
entityleash = EntityLeash.a(this.world, i, j, k);
}
-
- this.bw = entityleash;
- } else {
+ // Poweruser start
+ this.setLeashHolder(entityleash, true);
+ }
+ if (this.bw == null) {
+ // Poweruser end
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
this.unleash(false, true);
}
--
2.13.3