Skip to content

SpawnReason 5.46.0 ​

final class · pocketmine\entity\SpawnReason · source

Why a mob came into the world (like Paper's CreatureSpawnEvent.SpawnReason). It is kept with the mob (Living::getSpawnReason()) and saved with it. The natural spawner uses it for its population caps (mobs.spawning.count-all-mobs-for-spawning in pocketmine.yml).

Plugins may use their own reasons (any string); mobs of plugin classes count as SpawnReason::CUSTOM.

Constants ​

BREEDING ​

php
public const BREEDING = "breeding"

Two mobs bred.

CUSTOM ​

php
public const CUSTOM = "custom"

A plugin spawned the mob.

DEFAULT ​

php
public const DEFAULT = "default"

The reason was not recorded (mobs created before reasons existed, or by code that does not set one).

NATURAL ​

php
public const NATURAL = "natural"

Natural spawning around players with the spawn rules.

NATURAL_REASONS ​

php
public const NATURAL_REASONS = [self::NATURAL, self::STRUCTURE, self::WANDERING_TRADER, self::VILLAGE_CAT, self::PATROL]

Reasons that count as natural spawning when count-all-mobs-for-spawning is false.

PATROL ​

php
public const PATROL = "patrol"

A pillager patrol.

RAID ​

php
public const RAID = "raid"

A raid wave.

SPAWNER ​

php
public const SPAWNER = "spawner"

A monster spawner block.

SPAWN_EGG ​

php
public const SPAWN_EGG = "spawn_egg"

A spawn egg used by a player or a dispenser.

STRUCTURE ​

php
public const STRUCTURE = "structure"

Spawns of a structure (witch huts, nether fortresses, ocean monuments...).

VILLAGE_CAT ​

php
public const VILLAGE_CAT = "village_cat"

A stray cat of a village.

WANDERING_TRADER ​

php
public const WANDERING_TRADER = "wandering_trader"

A wandering trader and its llamas.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.