From 199b11bdd076cdf0cfdc66dbfa1064e57c4f2484 Mon Sep 17 00:00:00 2001 From: Thinkofname Date: Wed, 20 Apr 2016 11:40:16 +0100 Subject: SPIGOT-2157: Fix enderman not playing their animation when attacking --- nms-patches/EntityEnderman.patch | 41 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'nms-patches/EntityEnderman.patch') diff --git a/nms-patches/EntityEnderman.patch b/nms-patches/EntityEnderman.patch index 3292a9e7..a48336b7 100644 --- a/nms-patches/EntityEnderman.patch +++ b/nms-patches/EntityEnderman.patch @@ -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)) { -- cgit v1.2.3