CraftBukkit/nms-patches/PathfinderGoalTarget.patch
2021-03-09 08:47:33 +11:00

30 lines
1.1 KiB
Diff

--- a/net/minecraft/server/PathfinderGoalTarget.java
+++ b/net/minecraft/server/PathfinderGoalTarget.java
@@ -2,6 +2,8 @@
import javax.annotation.Nullable;
+import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit
+
public abstract class PathfinderGoalTarget extends PathfinderGoal {
protected final EntityInsentient e;
@@ -59,7 +61,7 @@
if (entityliving instanceof EntityHuman && ((EntityHuman) entityliving).abilities.isInvulnerable) {
return false;
} else {
- this.e.setGoalTarget(entityliving);
+ this.e.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // CraftBukkit
return true;
}
}
@@ -80,7 +82,7 @@
@Override
public void d() {
- this.e.setGoalTarget((EntityLiving) null);
+ this.e.setGoalTarget((EntityLiving) null, EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
this.g = null;
}