--- a/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
+++ b/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
@@ -5,16 +5,25 @@
 import net.minecraft.server.level.ServerLevel;
 import net.minecraft.util.valueproviders.UniformInt;
 import net.minecraft.world.entity.AgeableMob;
+import net.minecraft.world.entity.Entity;
 import net.minecraft.world.entity.LivingEntity;
 import net.minecraft.world.entity.ai.memory.MemoryModuleType;
 import net.minecraft.world.entity.ai.memory.MemoryStatus;
 
+// CraftBukkit start
+import org.bukkit.craftbukkit.v1_19_R1.entity.CraftLivingEntity;
+import org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityTargetEvent;
+import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
+// CraftBukkit end
+
 public class BabyFollowAdult<E extends AgeableMob> extends Behavior<E> {
+
     private final UniformInt followRange;
     private final Function<LivingEntity, Float> speedModifier;
 
     public BabyFollowAdult(UniformInt executionRange, float speed) {
-        this(executionRange, (entity) -> {
+        this(executionRange, (entityliving) -> {
             return speed;
         });
     }
@@ -25,22 +34,31 @@
         this.speedModifier = speed;
     }
 
-    @Override
     protected boolean checkExtraStartConditions(ServerLevel world, E entity) {
         if (!entity.isBaby()) {
             return false;
         } else {
-            AgeableMob ageableMob = this.getNearestAdult(entity);
-            return entity.closerThan(ageableMob, (double)(this.followRange.getMaxValue() + 1)) && !entity.closerThan(ageableMob, (double)this.followRange.getMinValue());
+            AgeableMob entityageable = this.getNearestAdult(entity);
+
+            return entity.closerThan(entityageable, (double) (this.followRange.getMaxValue() + 1)) && !entity.closerThan(entityageable, (double) this.followRange.getMinValue());
         }
     }
 
-    @Override
     protected void start(ServerLevel world, E entity, long time) {
-        BehaviorUtils.setWalkAndLookTargetMemories(entity, this.getNearestAdult(entity), this.speedModifier.apply(entity), this.followRange.getMinValue() - 1);
+        // CraftBukkit start
+        EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(entity, this.getNearestAdult(entity), EntityTargetEvent.TargetReason.FOLLOW_LEADER);
+        if (event.isCancelled()) {
+            return;
+        }
+        if (event.getTarget() != null) {
+            BehaviorUtils.setWalkAndLookTargetMemories(entity, ((CraftLivingEntity) event.getTarget()).getHandle(), this.speedModifier.apply(entity), this.followRange.getMinValue() - 1);
+        } else {
+            entity.getBrain().eraseMemory(MemoryModuleType.NEAREST_VISIBLE_ADULT);
+        }
+        // CraftBukkit end
     }
 
     private AgeableMob getNearestAdult(E entity) {
-        return entity.getBrain().getMemory(MemoryModuleType.NEAREST_VISIBLE_ADULT).get();
+        return (AgeableMob) entity.getBrain().getMemory(MemoryModuleType.NEAREST_VISIBLE_ADULT).get();
     }
 }
