Documentation

MonsterSpawner extends Spawnable
in package

Tags
deprecated

Table of Contents

DEFAULT_MAX_NEARBY_ENTITIES  = 6
DEFAULT_MAX_SPAWN_DELAY  = 800
DEFAULT_MIN_SPAWN_DELAY  = 200
DEFAULT_REQUIRED_PLAYER_RANGE  = 16
DEFAULT_SPAWN_RANGE  = 4
TAG_ID  = "id"
TAG_X  = "x"
TAG_Y  = "y"
TAG_Z  = "z"
TAG_ENTITY_HEIGHT  = "DisplayEntityHeight"
TAG_ENTITY_SCALE  = "DisplayEntityScale"
TAG_ENTITY_TYPE_ID  = "EntityIdentifier"
TAG_ENTITY_WIDTH  = "DisplayEntityWidth"
TAG_LEGACY_ENTITY_TYPE_ID  = "EntityId"
TAG_MAX_NEARBY_ENTITIES  = "MaxNearbyEntities"
TAG_MAX_SPAWN_DELAY  = "MaxSpawnDelay"
TAG_MIN_SPAWN_DELAY  = "MinSpawnDelay"
TAG_REQUIRED_PLAYER_RANGE  = "RequiredPlayerRange"
TAG_SPAWN_DATA  = "SpawnData"
TAG_SPAWN_DELAY  = "Delay"
TAG_SPAWN_PER_ATTEMPT  = "SpawnCount"
TAG_SPAWN_POTENTIALS  = "SpawnPotentials"
TAG_SPAWN_RANGE  = "SpawnRange"
$closed  : bool
$position  : Position
$timings  : TimingsHandler
$dirty  : bool
$displayEntityHeight  : float
$displayEntityScale  : float
$displayEntityWidth  : float
$entityTypeId  : string
$maxNearbyEntities  : int
$maxSpawnDelay  : int
$minSpawnDelay  : int
$requiredPlayerRange  : int
$spawnCompoundCache  : CacheableNbt|null
$spawnData  : CompoundTag|null
$spawnDelay  : int
$spawnPerAttempt  : int
$spawnPotentials  : ListTag|null
$spawnRange  : int
__construct()  : mixed
__destruct()  : mixed
close()  : void
getBlock()  : Block
getCleanedNBT()  : CompoundTag|null
getPosition()  : Position
getSerializedSpawnCompound()  : CacheableNbt
Returns encoded NBT (varint, little-endian) used to spawn this tile to clients. Uses cache where possible, populates cache if it is null.
getSpawnCompound()  : CompoundTag
isClosed()  : bool
isDirty()  : bool
Returns whether the tile needs to be respawned to viewers.
onBlockDestroyed()  : void
Called when the tile's block is destroyed.
readSaveData()  : void
saveNBT()  : CompoundTag
setDirty()  : void
addAdditionalSpawnData()  : void
An extension to getSpawnCompound() for further modifying the generic tile NBT.
onBlockDestroyedHook()  : void
Override this method to do actions you need to do when this tile is destroyed due to block being broken.
writeSaveData()  : void

Constants

DEFAULT_MAX_NEARBY_ENTITIES

public mixed DEFAULT_MAX_NEARBY_ENTITIES = 6

DEFAULT_MAX_SPAWN_DELAY

public mixed DEFAULT_MAX_SPAWN_DELAY = 800

DEFAULT_MIN_SPAWN_DELAY

public mixed DEFAULT_MIN_SPAWN_DELAY = 200

DEFAULT_REQUIRED_PLAYER_RANGE

public mixed DEFAULT_REQUIRED_PLAYER_RANGE = 16

TAG_ID

public mixed TAG_ID = "id"

TAG_X

public mixed TAG_X = "x"

TAG_Y

public mixed TAG_Y = "y"

TAG_Z

public mixed TAG_Z = "z"

TAG_ENTITY_HEIGHT

private mixed TAG_ENTITY_HEIGHT = "DisplayEntityHeight"

TAG_ENTITY_SCALE

private mixed TAG_ENTITY_SCALE = "DisplayEntityScale"

TAG_ENTITY_TYPE_ID

private mixed TAG_ENTITY_TYPE_ID = "EntityIdentifier"

TAG_ENTITY_WIDTH

private mixed TAG_ENTITY_WIDTH = "DisplayEntityWidth"

TAG_LEGACY_ENTITY_TYPE_ID

private mixed TAG_LEGACY_ENTITY_TYPE_ID = "EntityId"

TAG_MAX_NEARBY_ENTITIES

private mixed TAG_MAX_NEARBY_ENTITIES = "MaxNearbyEntities"

TAG_MAX_SPAWN_DELAY

private mixed TAG_MAX_SPAWN_DELAY = "MaxSpawnDelay"

TAG_MIN_SPAWN_DELAY

private mixed TAG_MIN_SPAWN_DELAY = "MinSpawnDelay"

TAG_REQUIRED_PLAYER_RANGE

private mixed TAG_REQUIRED_PLAYER_RANGE = "RequiredPlayerRange"

TAG_SPAWN_PER_ATTEMPT

private mixed TAG_SPAWN_PER_ATTEMPT = "SpawnCount"

TAG_SPAWN_POTENTIALS

private mixed TAG_SPAWN_POTENTIALS = "SpawnPotentials"

Properties

$closed

public bool $closed = false

$entityTypeId

private string $entityTypeId = ":"

TODO: replace this with a cached entity or something of that nature

$maxNearbyEntities

private int $maxNearbyEntities = self::DEFAULT_MAX_NEARBY_ENTITIES

$maxSpawnDelay

private int $maxSpawnDelay = self::DEFAULT_MAX_SPAWN_DELAY

$minSpawnDelay

private int $minSpawnDelay = self::DEFAULT_MIN_SPAWN_DELAY

$requiredPlayerRange

private int $requiredPlayerRange = self::DEFAULT_REQUIRED_PLAYER_RANGE

$spawnCompoundCache

private CacheableNbt|null $spawnCompoundCache = null
Tags
phpstan-var

CacheableNbt<\pocketmine\nbt\tag\CompoundTag>|null

$spawnData

private CompoundTag|null $spawnData = null

TODO: deserialize this properly and drop the NBT (PC and PE formats are different, just for fun)

$spawnDelay

private int $spawnDelay = self::DEFAULT_MIN_SPAWN_DELAY

$spawnPotentials

private ListTag|null $spawnPotentials = null

TODO: deserialize this properly and drop the NBT (PC and PE formats are different, just for fun)

Methods

__destruct()

public __destruct() : mixed
Return values
mixed

close()

public close() : void
Return values
void

getSerializedSpawnCompound()

Returns encoded NBT (varint, little-endian) used to spawn this tile to clients. Uses cache where possible, populates cache if it is null.

public final getSerializedSpawnCompound() : CacheableNbt
Tags
phpstan-return

CacheableNbt<\pocketmine\nbt\tag\CompoundTag>

Return values
CacheableNbt

isClosed()

public isClosed() : bool
Return values
bool

isDirty()

Returns whether the tile needs to be respawned to viewers.

public isDirty() : bool
Return values
bool

onBlockDestroyed()

Called when the tile's block is destroyed.

public final onBlockDestroyed() : void
Return values
void

setDirty()

public setDirty([bool $dirty = true ]) : void
Parameters
$dirty : bool = true
Return values
void

addAdditionalSpawnData()

An extension to getSpawnCompound() for further modifying the generic tile NBT.

protected addAdditionalSpawnData(CompoundTag $nbt) : void
Parameters
$nbt : CompoundTag
Return values
void

onBlockDestroyedHook()

Override this method to do actions you need to do when this tile is destroyed due to block being broken.

protected onBlockDestroyedHook() : void
Return values
void

Search results