Skip to content

SpawnEgg ​

abstract class · pocketmine\item\SpawnEgg · source

Extends Item

Methods ​

createEntity() protected ​

php
protected function createEntity(\pocketmine\world\World $world, \pocketmine\math\Vector3 $pos, float $yaw, float $pitch) : ?\pocketmine\entity\Entity

Creates the entity of this egg, or returns null if there is none. By default, the entity is created by the factory registered in EntitySpawnRegistry for SpawnEgg::getEntityTypeId().

getEntityTypeId() 5.46.0 ​

php
public function getEntityTypeId() : ?string

Returns the Bedrock identifier of the mob in this egg (e.g. "minecraft:zombie"), used to set the mob of a monster spawner, or null if unknown.

onInteractBlock() ​

php
public function onInteractBlock(\pocketmine\player\Player $player, \pocketmine\block\Block $blockReplace, \pocketmine\block\Block $blockClicked, int $face, \pocketmine\math\Vector3 $clickVector, array &$returnedItems) : \pocketmine\item\ItemUseResult

spawnEntity() 5.46.0 ​

php
public function spawnEntity(\pocketmine\world\World $world, \pocketmine\math\Vector3 $pos, float $yaw, float $pitch) : ?\pocketmine\entity\Entity

Creates and spawns the entity of this egg at the given position (e.g. for dispensers). Does not consume the egg. Returns null if there is no entity implementation for this egg's mob.

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