SPIGOT-2157: Fix enderman not playing their animation when attacking
By: Thinkofname <thinkofdeath@spigotmc.org>
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
}
|
||||
|
||||
protected void r() {}
|
||||
@@ -110,7 +122,37 @@
|
||||
@@ -110,7 +122,38 @@
|
||||
}
|
||||
|
||||
public void setGoalTarget(EntityLiving entityliving) {
|
||||
@@ -34,8 +34,8 @@
|
||||
+ setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
|
||||
+ }
|
||||
+
|
||||
+ public void setGoalTarget(EntityLiving entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
||||
+ if (getGoalTarget() == entityliving) return;
|
||||
+ public boolean setGoalTarget(EntityLiving entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
||||
+ if (getGoalTarget() == entityliving) return false;
|
||||
+ if (fireEvent) {
|
||||
+ if (reason == EntityTargetEvent.TargetReason.UNKNOWN && getGoalTarget() != null && entityliving == null) {
|
||||
+ reason = getGoalTarget().isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
|
||||
@@ -50,7 +50,7 @@
|
||||
+ EntityTargetLivingEntityEvent event = new EntityTargetLivingEntityEvent(this.getBukkitEntity(), ctarget, reason);
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (event.getTarget() != null) {
|
||||
@@ -60,11 +60,12 @@
|
||||
+ }
|
||||
+ }
|
||||
this.goalTarget = entityliving;
|
||||
+ return true;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean d(Class<? extends EntityLiving> oclass) {
|
||||
@@ -321,11 +363,20 @@
|
||||
@@ -321,11 +364,20 @@
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
@@ -87,7 +88,7 @@
|
||||
NBTTagList nbttaglist;
|
||||
int i;
|
||||
|
||||
@@ -549,11 +600,11 @@
|
||||
@@ -549,11 +601,11 @@
|
||||
double d2 = entityhuman.locZ - this.locZ;
|
||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
|
||||
@@ -101,7 +102,7 @@
|
||||
this.die();
|
||||
} else if (d3 < 1024.0D) {
|
||||
this.ticksFarFromPlayer = 0;
|
||||
@@ -931,9 +982,21 @@
|
||||
@@ -931,9 +983,21 @@
|
||||
|
||||
public final boolean a(EntityHuman entityhuman, ItemStack itemstack, EnumHand enumhand) {
|
||||
if (this.isLeashed() && this.getLeashHolder() == entityhuman) {
|
||||
@@ -123,7 +124,7 @@
|
||||
this.setLeashHolder(entityhuman, true);
|
||||
--itemstack.count;
|
||||
return true;
|
||||
@@ -953,10 +1016,12 @@
|
||||
@@ -953,10 +1017,12 @@
|
||||
|
||||
if (this.bC) {
|
||||
if (!this.isAlive()) {
|
||||
@@ -136,7 +137,7 @@
|
||||
this.unleash(true, true);
|
||||
}
|
||||
}
|
||||
@@ -967,7 +1032,9 @@
|
||||
@@ -967,7 +1033,9 @@
|
||||
this.bC = false;
|
||||
this.leashHolder = null;
|
||||
if (!this.world.isClientSide && flag1) {
|
||||
@@ -146,7 +147,7 @@
|
||||
}
|
||||
|
||||
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
|
||||
@@ -1037,6 +1104,7 @@
|
||||
@@ -1037,6 +1105,7 @@
|
||||
|
||||
this.leashHolder = entityleash;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user