Skip to content

TrialSpawnerSpawnData 5.47.0 ​

final class · pocketmine\block\trialspawner\TrialSpawnerSpawnData · source

One entry of a trial spawner's spawn potentials (vanilla SpawnData): the mob to spawn, as entity data ("id" plus a few fields such as "IsBaby" or the slime "Size"), and optionally the equipment loot table it gets.

Constants ​

TAG_ENTITY ​

php
public const TAG_ENTITY = "entity"

TAG_EQUIPMENT ​

php
public const TAG_EQUIPMENT = "equipment"

TAG_ID ​

php
public const TAG_ID = "id"

TAG_LOOT_TABLE ​

php
public const TAG_LOOT_TABLE = "loot_table"

TAG_SLOT_DROP_CHANCES ​

php
public const TAG_SLOT_DROP_CHANCES = "slot_drop_chances"

Methods ​

__construct() ​

php
public function __construct(\pocketmine\nbt\tag\CompoundTag $entity, ?string $equipmentLootTable = null, float $equipmentDropChance = 0.0)

arrayToCompound() ​

php
public static function arrayToCompound(array $data) : \pocketmine\nbt\tag\CompoundTag

Converts decoded JSON entity data to NBT (ints as TAG_Int, floats as TAG_Float).

fromArray() ​

php
public static function fromArray(array $data) : self

Reads spawn data in the shape of the configs ({"entity": {"id": ...}, "equipment": {...}}).

fromNbt() ​

php
public static function fromNbt(\pocketmine\nbt\tag\CompoundTag $nbt) : self

getEntityData() ​

php
public function getEntityData() : \pocketmine\nbt\tag\CompoundTag

The entity data (a copy).

getEntityId() ​

php
public function getEntityId() : ?string

The namespaced type of the mob ("minecraft:breeze"), or null if the data has none.

getEquipmentDropChance() ​

php
public function getEquipmentDropChance() : float

getEquipmentLootTable() ​

php
public function getEquipmentLootTable() : ?string

getSlimeSize() ​

php
public function getSlimeSize() : ?int

The slime size given by the data (Java "Size" is the size minus one), or null.

hasOnlyEntityId() ​

php
public function hasOnlyEntityId() : bool

Whether the data only names the mob: the mob then gets its random spawn variants (vanilla finalizeSpawn, e.g. baby zombies and spider jockeys), unlike mobs with set data.

isBaby() ​

php
public function isBaby() : bool

ofEntity() ​

php
public static function ofEntity(string $entityId) : self

Spawn data for a plain mob of the given type ("minecraft:zombie").

toNbt() ​

php
public function toNbt() : \pocketmine\nbt\tag\CompoundTag

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