Skip to content

BundledSpawnRules 5.47.0 ​

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

Compact table of the vanilla spawn rules shipped in resources/vanilla_spawn_rules.json: the SpawnConditions and populations that VanillaSpawnRules::loadFrom() reads from Mojang's files, as plain values. It is used when Mojang's files are not in the server's data folder, so that a server without network (or on its first start) spawns every vanilla mob instead of only the SpawnRules::builtin() ones.

Generated by tools/generate-vanilla-spawn-rules.php from the files pinned by VanillaSpawnRules::FILES; do not edit the JSON by hand. Only the values differing from the constructor defaults are stored.

Constants ​

FILE ​

php
public const FILE = "vanilla_spawn_rules.json"

Methods ​

decode() ​

php
public static function decode(array $data) : ?\pocketmine\world\mobs\spawn\SpawnRules

Reads rules in the bundled format; null if they were made for another Bedrock version.

encode() ​

php
public static function encode(\pocketmine\world\mobs\spawn\SpawnRules $rules) : array

Converts rules to the bundled format (generator).

get() ​

php
public static function get() : ?\pocketmine\world\mobs\spawn\SpawnRules

Returns the bundled rules (read once), or null if the file is missing, damaged or made for another Bedrock version than VanillaSpawnRules::TAG.

loadFile() ​

php
public static function loadFile(string $path) : ?\pocketmine\world\mobs\spawn\SpawnRules

toJson() ​

php
public static function toJson(\pocketmine\world\mobs\spawn\SpawnRules $rules) : string

VanillaMine is a fork of PocketMine-MP. Not affiliated with the PMMP team or Mojang.