Skip to content

EntityFactory ​

final class · pocketmine\entity\EntityFactory · source

This class manages the creation of entities loaded from disk. You need to register your entity into this factory if you want to load/save your entity on disk (saving with chunks).

Constants ​

TAG_IDENTIFIER ​

php
public const TAG_IDENTIFIER = "identifier"

TAG_LEGACY_ID ​

php
public const TAG_LEGACY_ID = "id"

Methods ​

__construct() ​

php
public function __construct()

getSaveId() ​

php
public function getSaveId(string $class) : string

injectSaveId() ​

php
public function injectSaveId(string $class, \pocketmine\nbt\tag\CompoundTag $saveData) : void

isRegistered() ​

php
public function isRegistered(string $class) : bool

register() ​

php
public function register(string $className, \Closure $creationFunc, array $saveNames) : void

Registers an entity type into the index.

NOTE: The first save name in the $saveNames array will be used when saving the entity to disk.

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