MobDespawner 5.46.0
Bedrock despawning of naturally spawned mobs ("minecraft:despawn" with despawn_from_distance), checked every MobDespawner::CHECK_INTERVAL ticks by the mob:
- instantly beyond the instant distance from every player: 128 blocks, 44 with simulation distance 4 (PocketMine chunk tick radius 4 or less), 40 for fish;
- beyond 32 blocks, a 1 in 800 chance per tick once the mob has been that far for 30 seconds;
- never while a player rides it. Persistent mobs (named, bred, tamed, tempted, spawned by an egg or a command...) never despawn: see
\pocketmine\entity\Mob::canDespawn().
Constants
CHECK_INTERVAL
public const CHECK_INTERVAL = 20FISH_INSTANT_DISTANCE
public const FISH_INSTANT_DISTANCE = 40INSTANT_DISTANCE
public const INSTANT_DISTANCE = 128RANDOM_CHANCE_PER_TICK
public const RANDOM_CHANCE_PER_TICK = 800Chance per tick of a random despawn (1 in 800).
RANDOM_DELAY
public const RANDOM_DELAY = 600Ticks a mob must stay beyond RANDOM_DISTANCE before it may despawn randomly.
RANDOM_DISTANCE
public const RANDOM_DISTANCE = 32SMALL_SIMULATION_INSTANT_DISTANCE
public const SMALL_SIMULATION_INSTANT_DISTANCE = 44Simulation distance 4: mobs despawn beyond the spawning range.
Methods
getInstantDistance()
public static function getInstantDistance(\pocketmine\world\World $world) : intInstant despawn distance of the world: mobs.spawning.instant-despawn-distance if set, otherwise 44 when the chunk tick radius is 4 or less (Bedrock simulation distance 4), else 128.
shouldDespawn()
public static function shouldDespawn(\pocketmine\entity\Living $mob, int &$farTicks, int $interval = self::CHECK_INTERVAL) : boolReturns whether the (non-persistent) mob should despawn now. $farTicks counts how long it has been beyond the random despawn distance.
shouldDespawnWhileFrozen()
public static function shouldDespawnWhileFrozen(\pocketmine\entity\Living $mob) : boolDespawn check of a (non-persistent) mob frozen beyond the simulation distance of every player: only the instant despawn rule of MobDespawner::shouldDespawn() applies (same distances, no random despawn, no randomness used), so that mobs left behind by players do not pile up and fill the population caps.
