Documentation

Sign extends Spawnable
in package

Tags
deprecated
see
BaseSign

Table of Contents

TAG_ID  = "id"
TAG_TEXT_BLOB  = "Text"
TAG_TEXT_LINE  = "Text%d"
TAG_X  = "x"
TAG_Y  = "y"
TAG_Z  = "z"
$closed  : bool
$editorEntityRuntimeId  : int|null
$position  : Position
$text  : SignText
$timings  : TimingsHandler
$dirty  : bool
$spawnCompoundCache  : CacheableNbt|null
__construct()  : mixed
__destruct()  : mixed
close()  : void
fixTextBlob()  : array<string|int, string>
getBlock()  : Block
getCleanedNBT()  : CompoundTag|null
getEditorEntityRuntimeId()  : int|null
Returns the entity runtime ID of the player who placed this sign. Only the player whose entity ID matches this one may edit the sign text.
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
getText()  : SignText
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
setEditorEntityRuntimeId()  : void
setText()  : 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

TAG_ID

public mixed TAG_ID = "id"

TAG_TEXT_BLOB

public mixed TAG_TEXT_BLOB = "Text"

TAG_TEXT_LINE

public mixed TAG_TEXT_LINE = "Text%d"

TAG_X

public mixed TAG_X = "x"

TAG_Y

public mixed TAG_Y = "y"

TAG_Z

public mixed TAG_Z = "z"

Properties

$closed

public bool $closed = false

$editorEntityRuntimeId

protected int|null $editorEntityRuntimeId = null

$spawnCompoundCache

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

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

Methods

__destruct()

public __destruct() : mixed
Return values
mixed

close()

public close() : void
Return values
void

fixTextBlob()

public static fixTextBlob(string $blob) : array<string|int, string>
Parameters
$blob : string
Return values
array<string|int, string>

getEditorEntityRuntimeId()

Returns the entity runtime ID of the player who placed this sign. Only the player whose entity ID matches this one may edit the sign text.

public getEditorEntityRuntimeId() : int|null

This is needed because as of 1.16.220, there is still no reliable way to detect when the MCPE client closed the sign edit GUI, so we have no way to know when the text is finalized. This limits editing of the text to only the player who placed it, and only while that player is online. We can say for sure that the sign is finalized if either of the following occurs:

  • The player quits (after rejoin, the player's entity runtimeID will be different).
  • The chunk is unloaded (on next load, the entity runtimeID will be null, because it's not saved).
Return values
int|null

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

setEditorEntityRuntimeId()

public setEditorEntityRuntimeId(int|null $editorEntityRuntimeId) : void
Parameters
$editorEntityRuntimeId : int|null
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