SPIGOT-2157: Fix enderman not playing their animation when attacking

By: Thinkofname <thinkofdeath@spigotmc.org>
This commit is contained in:
CraftBukkit/Spigot
2016-04-20 11:40:16 +01:00
parent 70d48f98d3
commit 7a3f710cf1
3 changed files with 62 additions and 20 deletions

View File

@@ -1,6 +1,43 @@
--- a/net/minecraft/server/EntityEnderman.java
+++ b/net/minecraft/server/EntityEnderman.java
@@ -306,8 +306,12 @@
@@ -4,6 +4,8 @@
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.collect.Sets;
+import org.bukkit.event.entity.EntityTargetEvent;
+
import java.util.Random;
import java.util.Set;
import java.util.UUID;
@@ -55,7 +57,18 @@
}
public void setGoalTarget(EntityLiving entityliving) {
- super.setGoalTarget(entityliving);
+ // CraftBukkit start - fire event
+ setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
+ }
+
+ @Override
+ public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
+ if (!super.setGoalTarget(entityliving, reason, fireEvent)) {
+ return false;
+ }
+ entityliving = getGoalTarget();
+ System.out.println(entityliving);
+ // CraftBukkit end
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
if (entityliving == null) {
@@ -69,6 +82,7 @@
attributeinstance.b(EntityEnderman.b);
}
}
+ return true;
}
@@ -306,8 +320,12 @@
boolean flag = movingobjectposition != null && movingobjectposition.a().equals(blockposition);
if (EntityEnderman.c.contains(block) && flag) {
@@ -15,7 +52,7 @@
}
}
@@ -337,8 +341,12 @@
@@ -337,8 +355,12 @@
IBlockData iblockdata2 = this.a.getCarried();
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2.getBlock(), iblockdata, iblockdata1)) {