--- 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, (Predicate<LivingEntity>)null);
+        this(mob, targetClass, 10, checkVisibility, false, (Predicate) null);
     }
 
     public NearestAttackableTargetGoal(Mob mob, Class<T> targetClass, boolean checkVisibility, Predicate<LivingEntity> targetPredicate) {
@@ -28,7 +29,7 @@
     }
 
     public NearestAttackableTargetGoal(Mob mob, Class<T> targetClass, boolean checkVisibility, boolean checkCanNavigate) {
-        this(mob, targetClass, 10, checkVisibility, checkCanNavigate, (Predicate<LivingEntity>)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) {
@@ -37,6 +38,7 @@
         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
     }
 
     @Override
@@ -55,7 +57,7 @@
 
     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) -> {
+            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 {
@@ -66,7 +68,7 @@
 
     @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();
     }
 
