--- a/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
+++ b/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
@@ -7,26 +7,48 @@
 import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder;
 import net.minecraft.world.entity.ai.memory.MemoryModuleType;
 import net.minecraft.world.entity.ai.memory.WalkTarget;
+// CraftBukkit start
+import org.bukkit.craftbukkit.v1_19_R2.entity.CraftLivingEntity;
+import org.bukkit.craftbukkit.v1_19_R2.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityTargetEvent;
+import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
+// CraftBukkit end
 
 public class BabyFollowAdult {
+
+    public BabyFollowAdult() {}
+
     public static OneShot<AgeableMob> create(UniformInt executionRange, float speed) {
-        return create(executionRange, (entity) -> {
+        return BabyFollowAdult.create(executionRange, (entityliving) -> {
             return speed;
         });
     }
 
     public static OneShot<AgeableMob> create(UniformInt executionRange, Function<LivingEntity, Float> speed) {
-        return BehaviorBuilder.create((context) -> {
-            return context.group(context.present(MemoryModuleType.NEAREST_VISIBLE_ADULT), context.registered(MemoryModuleType.LOOK_TARGET), context.absent(MemoryModuleType.WALK_TARGET)).apply(context, (nearestVisibleAdult, lookTarget, walkTarget) -> {
-                return (world, entity, time) -> {
-                    if (!entity.isBaby()) {
+        return BehaviorBuilder.create((behaviorbuilder_b) -> {
+            return behaviorbuilder_b.group(behaviorbuilder_b.present(MemoryModuleType.NEAREST_VISIBLE_ADULT), behaviorbuilder_b.registered(MemoryModuleType.LOOK_TARGET), behaviorbuilder_b.absent(MemoryModuleType.WALK_TARGET)).apply(behaviorbuilder_b, (memoryaccessor, memoryaccessor1, memoryaccessor2) -> {
+                return (worldserver, entityageable, i) -> {
+                    if (!entityageable.isBaby()) {
                         return false;
                     } else {
-                        AgeableMob ageableMob = context.get(nearestVisibleAdult);
-                        if (entity.closerThan(ageableMob, (double)(executionRange.getMaxValue() + 1)) && !entity.closerThan(ageableMob, (double)executionRange.getMinValue())) {
-                            WalkTarget walkTarget = new WalkTarget(new EntityTracker(ageableMob, false), speed.apply(entity), executionRange.getMinValue() - 1);
-                            lookTarget.set(new EntityTracker(ageableMob, true));
-                            walkTarget.set(walkTarget);
+                        LivingEntity entityageable1 = (AgeableMob) behaviorbuilder_b.get(memoryaccessor); // CraftBukkit - type
+
+                        if (entityageable.closerThan(entityageable1, (double) (executionRange.getMaxValue() + 1)) && !entityageable.closerThan(entityageable1, (double) executionRange.getMinValue())) {
+                            // CraftBukkit start
+                            EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(entityageable, entityageable1, EntityTargetEvent.TargetReason.FOLLOW_LEADER);
+                            if (event.isCancelled()) {
+                                return false;
+                            }
+                            if (event.getTarget() == null) {
+                                memoryaccessor.erase();
+                                return true;
+                            }
+                            entityageable1 = ((CraftLivingEntity) event.getTarget()).getHandle();
+                            // CraftBukkit end
+                            WalkTarget memorytarget = new WalkTarget(new EntityTracker(entityageable1, false), (Float) speed.apply(entityageable), executionRange.getMinValue() - 1);
+
+                            memoryaccessor1.set(new EntityTracker(entityageable1, true));
+                            memoryaccessor2.set(memorytarget);
                             return true;
                         } else {
                             return false;
