--- a/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java
@@ -10,6 +10,12 @@
 import net.minecraft.world.entity.ai.memory.MemoryModuleType;
 import net.minecraft.world.entity.ai.memory.MemoryStatus;
 
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityTargetEvent;
+// CraftBukkit end
+
 public class BehaviorAttackTargetForget<E extends EntityInsentient> extends Behavior<E> {
 
     private static final int TIMEOUT_TO_GET_WITHIN_ATTACK_RANGE = 200;
@@ -77,6 +83,17 @@
     }
 
     protected void a(E e0) {
+        // CraftBukkit start
+        EntityLiving old = e0.getBehaviorController().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
+        EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, null, (old != null && !old.isAlive()) ? EntityTargetEvent.TargetReason.TARGET_DIED : EntityTargetEvent.TargetReason.FORGOT_TARGET);
+        if (event.isCancelled()) {
+            return;
+        }
+        if (event.getTarget() != null) {
+            e0.getBehaviorController().setMemory(MemoryModuleType.ATTACK_TARGET, ((CraftLivingEntity) event.getTarget()).getHandle());
+            return;
+        }
+        // CraftBukkit end
         this.onTargetErased.accept(e0);
         e0.getBehaviorController().removeMemory(MemoryModuleType.ATTACK_TARGET);
     }
