Skip to content

EntitySpawnRegistry 5.46.0 ​

final class · pocketmine\entity\EntitySpawnRegistry · source

Maps Bedrock entity identifiers (e.g. "minecraft:cow") to factories creating a new entity of that type at a location, as a spawn egg, /summon or a monster spawner would.

Spawn eggs (\pocketmine\item\SpawnEgg) look up their entity here, so registering a factory for a mob makes its egg work. Plugins can register their own mobs or replace the built-in ones.

Methods ​

__construct() ​

php
public function __construct()

create() ​

php
public function create(string $identifier, \pocketmine\entity\Location $location) : ?\pocketmine\entity\Entity

Creates (without spawning to players) an entity of the given type, or returns null if there is no factory for it.

getIdentifiers() ​

php
public function getIdentifiers() : array

isRegistered() ​

php
public function isRegistered(string $identifier) : bool

register() ​

php
public function register(string $identifier, \Closure $factory) : void

unregister() ​

php
public function unregister(string $identifier) : void

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