package net.glowstone.entity.monster;

import net.glowstone.entity.GlowCreature;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Monster;

public class GlowMonster extends GlowCreature implements Monster {
    /**
     * Creates a new non-passive mob.
     *
     * @param loc  The location of the non-passive mob.
     * @param type The type of mob.
     * @param maxHealth The max health for this mob.
     */
    public GlowMonster(Location loc, EntityType type, double maxHealth) {
        super(loc, type, maxHealth);
    }
}

@@ -241,16 +241,182 @@
 nster %7B%0A
+    /**%0A     * The range in blocks outside of which the hostile mob will despawn immediately.%0A     */%0A    private static final double DESPAWN_RANGE_IMMEDIATE = 128;%0A%0A
     /**%0A
@@ -479,16 +479,21 @@
 am loc  
+     
 The loca
@@ -540,16 +540,21 @@
 am type 
+     
 The type
@@ -739,11 +739,878 @@
 );%0A    %7D
+%0A%0A    /**%0A     * Whether the hostile mob can despawn immediately.%0A     *%0A     * @return true if the mob can despawn immediately, false otherwise%0A     */%0A    public boolean canDespawnImmediately() %7B%0A        if (isRemoved()) %7B%0A            return false;%0A        %7D%0A        if (world.getPlayerCount() == 0) %7B%0A            return false;%0A        %7D%0A        if (isCustomNameVisible()) %7B%0A            return false;%0A        %7D%0A        boolean hasNearbyPlayer = world.getPlayers().stream()%0A                .anyMatch(player -%3E location.distanceSquared(player.getLocation()) %3C= DESPAWN_RANGE_IMMEDIATE * DESPAWN_RANGE_IMMEDIATE);%0A        if (hasNearbyPlayer) %7B%0A            return false;%0A        %7D%0A        return true;%0A    %7D%0A%0A    @Override%0A    public void pulse() %7B%0A        if (canDespawnImmediately()) %7B%0A            remove();%0A            return;%0A        %7D%0A        super.pulse();%0A    %7D
 %0A%7D%0A

Add immediate despawning for out-of-range hostile mobs