Fixes to mob equipment behaviour

* Set correct flag for CanPickUpLoot on NBT load
* Drop previous equipment on mob equipment pickup
This commit is contained in:
Jacob Martin 2017-04-08 18:05:32 -05:00 committed by md_5
parent 1f6c04c0f4
commit d219213e2b

View File

@ -75,7 +75,7 @@
- this.m(nbttagcompound.getBoolean("CanPickUpLoot")); - this.m(nbttagcompound.getBoolean("CanPickUpLoot"));
+ boolean data = nbttagcompound.getBoolean("CanPickUpLoot"); + boolean data = nbttagcompound.getBoolean("CanPickUpLoot");
+ if (isLevelAtLeast(nbttagcompound, 1) || data) { + if (isLevelAtLeast(nbttagcompound, 1) || data) {
+ this.l(data); + this.m(data);
+ } + }
} }
@ -88,7 +88,17 @@
NBTTagList nbttaglist; NBTTagList nbttaglist;
int i; int i;
@@ -569,11 +621,11 @@ @@ -521,7 +573,9 @@
}
if (!itemstack1.isEmpty() && (double) (this.random.nextFloat() - 0.1F) < d0) {
+ this.forceDrops = true; // CraftBukkit
this.a(itemstack1, 0.0F);
+ this.forceDrops = false; // CraftBukkit
}
if (itemstack.getItem() == Items.DIAMOND && entityitem.n() != null) {
@@ -569,11 +623,11 @@
double d2 = entityhuman.locZ - this.locZ; double d2 = entityhuman.locZ - this.locZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2; double d3 = d0 * d0 + d1 * d1 + d2 * d2;
@ -102,7 +112,7 @@
this.die(); this.die();
} else if (d3 < 1024.0D) { } else if (d3 < 1024.0D) {
this.ticksFarFromPlayer = 0; this.ticksFarFromPlayer = 0;
@@ -942,12 +994,24 @@ @@ -942,12 +996,24 @@
public final boolean b(EntityHuman entityhuman, EnumHand enumhand) { public final boolean b(EntityHuman entityhuman, EnumHand enumhand) {
if (this.isLeashed() && this.getLeashHolder() == entityhuman) { if (this.isLeashed() && this.getLeashHolder() == entityhuman) {
@ -127,7 +137,7 @@
this.setLeashHolder(entityhuman, true); this.setLeashHolder(entityhuman, true);
itemstack.subtract(1); itemstack.subtract(1);
return true; return true;
@@ -968,10 +1032,12 @@ @@ -968,10 +1034,12 @@
if (this.bD) { if (this.bD) {
if (!this.isAlive()) { if (!this.isAlive()) {
@ -140,7 +150,7 @@
this.unleash(true, true); this.unleash(true, true);
} }
} }
@@ -982,7 +1048,9 @@ @@ -982,7 +1050,9 @@
this.bD = false; this.bD = false;
this.leashHolder = null; this.leashHolder = null;
if (!this.world.isClientSide && flag1) { if (!this.world.isClientSide && flag1) {
@ -150,7 +160,7 @@
} }
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) { if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
@@ -1052,6 +1120,7 @@ @@ -1052,6 +1122,7 @@
this.setLeashHolder(entityleash, true); this.setLeashHolder(entityleash, true);
} else { } else {