SpawnRules 5.46.0
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
public const SNOW_TEMPERATURE = 0.15Biomes where snow falls (is_snow_covered): base temperature below this.
Methods
__construct()
public function __construct(array $conditions, array $populations, string $source)builtin()
public static function builtin() : selfFallback 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()
public function forBiome(int $biomeId) : arrayReturns the conditions whose biome filter accepts the biome (cached per biome).
forBiomeTags()
public function forBiomeTags(array $tags, bool $snowCovered) : arraygetConditions()
public function getConditions() : arraygetPopulation()
public function getPopulation(string $identifier) : ?stringReturns 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()
public function getPopulations() : arraygetSource()
public function getSource() : stringWhere the rules come from (for logs), e.g. "Mojang/bedrock-samples v1.26.50.4".
