SPIGOT-4893: Don't reset angry state of wolves without target.

Wolves will 'silently' lose their target when teleporting between
dimensions or the chunk getting reloaded. To reset the angry state in
those cases, the check got moved into the loading method.
This commit is contained in:
blablubbabc 2019-05-08 02:18:05 +02:00 committed by md_5
parent 5c0d3b25e8
commit 8879c31485

View file

@ -44,7 +44,28 @@
@Override @Override
public void setGoalTarget(@Nullable EntityLiving entityliving) { public void setGoalTarget(@Nullable EntityLiving entityliving) {
super.setGoalTarget(entityliving); super.setGoalTarget(entityliving);
@@ -217,7 +238,8 @@ @@ -101,6 +122,11 @@
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
this.setAngry(nbttagcompound.getBoolean("Angry"));
+ // CraftBukkit start - moved from below, SPIGOT-4893
+ if (this.getGoalTarget() == null && this.isAngry()) {
+ this.setAngry(false);
+ }
+ // CraftBukkit end
if (nbttagcompound.hasKeyOfType("CollarColor", 99)) {
this.setCollarColor(EnumColor.fromColorIndex(nbttagcompound.getInt("CollarColor")));
}
@@ -137,7 +163,7 @@
this.world.broadcastEntityEffect(this, (byte) 8);
}
- if (!this.world.isClientSide && this.getGoalTarget() == null && this.isAngry()) {
+ if (false && !this.world.isClientSide && this.getGoalTarget() == null && this.isAngry()) { // CraftBukkit - SPIGOT-4893
this.setAngry(false);
}
@@ -217,7 +243,8 @@
Entity entity = damagesource.getEntity(); Entity entity = damagesource.getEntity();
if (this.goalSit != null) { if (this.goalSit != null) {
@ -54,7 +75,7 @@
} }
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) { if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
@@ -264,7 +286,7 @@ @@ -264,7 +291,7 @@
itemstack.subtract(1); itemstack.subtract(1);
} }
@ -63,7 +84,7 @@
return true; return true;
} }
} else if (item instanceof ItemDye) { } else if (item instanceof ItemDye) {
@@ -285,7 +307,7 @@ @@ -285,7 +312,7 @@
this.goalSit.setSitting(!this.isSitting()); this.goalSit.setSitting(!this.isSitting());
this.jumping = false; this.jumping = false;
this.navigation.o(); this.navigation.o();
@ -72,7 +93,7 @@
} }
} else if (item == Items.BONE && !this.isAngry()) { } else if (item == Items.BONE && !this.isAngry()) {
if (!entityhuman.abilities.canInstantlyBuild) { if (!entityhuman.abilities.canInstantlyBuild) {
@@ -293,12 +315,13 @@ @@ -293,12 +320,13 @@
} }
if (!this.world.isClientSide) { if (!this.world.isClientSide) {