--- a/net/minecraft/world/entity/IEntityAngerable.java +++ b/net/minecraft/world/entity/IEntityAngerable.java @@ -9,6 +9,10 @@ import net.minecraft.world.level.GameRules; import net.minecraft.world.level.World; +// CraftBukkit start +import org.bukkit.event.entity.EntityTargetEvent; +// CraftBukkit end + public interface IEntityAngerable { String TAG_ANGER_TIME = "AngerTime"; @@ -48,14 +52,14 @@ if (entity instanceof EntityInsentient) { EntityInsentient entityinsentient = (EntityInsentient) entity; - this.setTarget(entityinsentient); + this.setTarget(entityinsentient, EntityTargetEvent.TargetReason.UNKNOWN, false); // CraftBukkit this.setLastHurtByMob(entityinsentient); } if (entity instanceof EntityHuman) { EntityHuman entityhuman = (EntityHuman) entity; - this.setTarget(entityhuman); + this.setTarget(entityhuman, EntityTargetEvent.TargetReason.UNKNOWN, false); // CraftBukkit this.setLastHurtByPlayer(entityhuman); } @@ -114,7 +118,7 @@ default void stopBeingAngry() { this.setLastHurtByMob((EntityLiving) null); this.setPersistentAngerTarget((UUID) null); - this.setTarget((EntityLiving) null); + this.setTarget((EntityLiving) null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit this.setRemainingPersistentAngerTime(0); } @@ -127,6 +131,8 @@ void setTarget(@Nullable EntityLiving entityliving); + boolean setTarget(@Nullable EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent); // CraftBukkit + boolean canAttack(EntityLiving entityliving); @Nullable