Skip to content

BabySpawning 5.47.0 ​

final class · pocketmine\entity\BabySpawning · source

Babies of mobs that aren't bred: the baby chance of natural and spawn egg spawns (Bedrock minecraft:entity_spawned, see Mob::getSpawnBabyChance()) and spawn eggs used on a mob of their kind (minecraft:spawn_egg_interaction).

Methods ​

createBabyFromEgg() ​

php
public static function createBabyFromEgg(\pocketmine\entity\Mob $parent, \pocketmine\item\SpawnEgg $egg) : ?\pocketmine\entity\Mob

Creates (without spawning) the baby that the given spawn egg makes when it is used on the parent: a baby of the parent's kind at its position, if the egg is the parent's own and that kind has babies. Returns null otherwise.

rollSpawnBaby() ​

php
public static function rollSpawnBaby(\pocketmine\entity\Entity $entity) : bool

Rolls the baby chance of a mob that was just created by the natural spawner or a spawn egg, before it is shown to players. Returns whether it became a baby.

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