--- a/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java
+++ b/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java
@@ -12,6 +12,7 @@
 import net.minecraft.world.phys.AABB;
 
 public class NearestAttackableTargetGoal<T extends LivingEntity> extends TargetGoal {
+
     private static final int DEFAULT_RANDOM_INTERVAL = 10;
     protected final Class<T> targetType;
     protected final int randomInterval;
@@ -20,7 +21,7 @@
     protected TargetingConditions targetConditions;
 
     public NearestAttackableTargetGoal(Mob mob, Class<T> targetClass, boolean checkVisibility) {
-        this(mob, targetClass, 10, checkVisibility, false, null);
+        this(mob, targetClass, 10, checkVisibility, false, (Predicate) null);
     }
 
     public NearestAttackableTargetGoal(Mob mob, Class<T> targetClass, boolean checkVisibility, Predicate<LivingEntity> targetPredicate) {
@@ -28,22 +29,16 @@
     }
 
     public NearestAttackableTargetGoal(Mob mob, Class<T> targetClass, boolean checkVisibility, boolean checkCanNavigate) {
-        this(mob, targetClass, 10, checkVisibility, checkCanNavigate, null);
+        this(mob, targetClass, 10, checkVisibility, checkCanNavigate, (Predicate) null);
     }
 
-    public NearestAttackableTargetGoal(
-        Mob mob,
-        Class<T> targetClass,
-        int reciprocalChance,
-        boolean checkVisibility,
-        boolean checkCanNavigate,
-        @Nullable Predicate<LivingEntity> targetPredicate
-    ) {
+    public NearestAttackableTargetGoal(Mob mob, Class<T> targetClass, int reciprocalChance, boolean checkVisibility, boolean checkCanNavigate, @Nullable Predicate<LivingEntity> targetPredicate) {
         super(mob, checkVisibility, checkCanNavigate);
         this.targetType = targetClass;
         this.randomInterval = reducedTickDelay(reciprocalChance);
         this.setFlags(EnumSet.of(Goal.Flag.TARGET));
         this.targetConditions = TargetingConditions.forCombat().range(this.getFollowDistance()).selector(targetPredicate);
+        if (mob.level().paperConfig().entities.entitiesTargetWithFollowRange) this.targetConditions.useFollowRange(); // Paper - Fix MC-145656
     }
 
     @Override
@@ -57,29 +52,23 @@
     }
 
     protected AABB getTargetSearchArea(double distance) {
-        return this.mob.getBoundingBox().inflate(distance, 4.0, distance);
+        return this.mob.getBoundingBox().inflate(distance, 4.0D, distance);
     }
 
     protected void findTarget() {
         if (this.targetType != Player.class && this.targetType != ServerPlayer.class) {
-            this.target = this.mob
-                .level()
-                .getNearestEntity(
-                    this.mob.level().getEntitiesOfClass(this.targetType, this.getTargetSearchArea(this.getFollowDistance()), livingEntity -> true),
-                    this.targetConditions,
-                    this.mob,
-                    this.mob.getX(),
-                    this.mob.getEyeY(),
-                    this.mob.getZ()
-                );
+            this.target = this.mob.level().getNearestEntity(this.mob.level().getEntitiesOfClass(this.targetType, this.getTargetSearchArea(this.getFollowDistance()), (entityliving) -> {
+                return true;
+            }), this.targetConditions, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ());
         } else {
             this.target = this.mob.level().getNearestPlayer(this.targetConditions, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ());
         }
+
     }
 
     @Override
     public void start() {
-        this.mob.setTarget(this.target);
+        this.mob.setTarget(this.target, this.target instanceof ServerPlayer ? org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER : org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // CraftBukkit - reason
         super.start();
     }
 
