--- a/net/minecraft/world/entity/NeutralMob.java +++ b/net/minecraft/world/entity/NeutralMob.java @@ -8,6 +8,9 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; +// CraftBukkit start +import org.bukkit.event.entity.EntityTargetEvent; +// CraftBukkit end public interface NeutralMob { @@ -48,14 +51,14 @@ if (entity instanceof Mob) { Mob entityinsentient = (Mob) entity; - this.setTarget(entityinsentient); + this.setTarget(entityinsentient, EntityTargetEvent.TargetReason.UNKNOWN, false); // CraftBukkit this.setLastHurtByMob(entityinsentient); } if (entity instanceof Player) { Player entityhuman = (Player) entity; - this.setTarget(entityhuman); + this.setTarget(entityhuman, EntityTargetEvent.TargetReason.UNKNOWN, false); // CraftBukkit this.setLastHurtByPlayer(entityhuman); } @@ -114,7 +117,7 @@ default void stopBeingAngry() { this.setLastHurtByMob((LivingEntity) null); this.setPersistentAngerTarget((UUID) null); - this.setTarget((LivingEntity) null); + this.setTarget((LivingEntity) null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit this.setRemainingPersistentAngerTime(0); } @@ -127,6 +130,8 @@ void setTarget(@Nullable LivingEntity target); + boolean setTarget(@Nullable LivingEntity entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent); // CraftBukkit + boolean canAttack(LivingEntity target); @Nullable