SpawnRuleParser 5.46.0
Reads Bedrock spawn rule files (behavior_pack/spawn_rules/.json). Mojang's files are "JSON with comments": they contain // and / */ comments and sometimes trailing commas, which are removed before decoding.
Methods
parse()
php
public static function parse(string $json) : arrayParses a spawn rule file. Returns its conditions (empty for mobs without natural spawning, e.g. cats or guardians, whose rule only declares the population type).
parseDescription()
php
public static function parseDescription(string $json) : arrayReturns the population control ("monster", "animal"...) and identifier declared by a spawn rule file.
stripJsonComments()
php
public static function stripJsonComments(string $json) : stringRemoves comments (outside strings) and trailing commas.
