Skip to content

SpawnRules 5.46.0 ​

final class · pocketmine\world\mobs\spawn\SpawnRules · source

A set of spawn rules (see SpawnCondition), indexed by biome. The vanilla set is read from Mojang's files (see VanillaSpawnRules); SpawnRules::builtin() is a small fallback used until they are available.

Constants ​

SNOW_TEMPERATURE ​

php
public const SNOW_TEMPERATURE = 0.15

Biomes where snow falls (is_snow_covered): base temperature below this.

Methods ​

__construct() ​

php
public function __construct(array $conditions, array $populations, string $source)

builtin() ​

php
public static function builtin() : self

Fallback rules used while Mojang's spawn rules are not available (no network, or still downloading): the common Overworld mobs with their vanilla Bedrock values (zombie, skeleton, creeper, spider, cow, pig, sheep, chicken).

forBiome() ​

php
public function forBiome(int $biomeId) : array

Returns the conditions whose biome filter accepts the biome (cached per biome).

forBiomeTags() ​

php
public function forBiomeTags(array $tags, bool $snowCovered) : array

getConditions() ​

php
public function getConditions() : array

getPopulation() ​

php
public function getPopulation(string $identifier) : ?string

Returns the population control of the mob ("monster", "animal", "water_animal", "ambient"...), or null if it has no spawn rule (it then counts towards no population cap).

getPopulations() ​

php
public function getPopulations() : array

getSource() ​

php
public function getSource() : string

Where the rules come from (for logs), e.g. "Mojang/bedrock-samples v1.26.50.4".

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