Documentation

Bell extends Spawnable
in package

Table of Contents

TAG_DIRECTION  = "Direction"
TAG_ID  = "id"
TAG_RINGING  = "Ringing"
TAG_TICKS  = "Ticks"
TAG_X  = "x"
TAG_Y  = "y"
TAG_Z  = "z"
$closed  : bool
$position  : Position
$timings  : TimingsHandler
$dirty  : bool
$facing  : int
$ringing  : bool
$spawnCompoundCache  : CacheableNbt|null
$ticks  : int
__construct()  : mixed
__destruct()  : mixed
close()  : void
createFakeUpdatePacket()  : BlockActorDataPacket
TODO: HACK! Creates a BlockActorDataPacket that triggers the ringing animation on a bell block.
getBlock()  : Block
getCleanedNBT()  : CompoundTag|null
getFacing()  : int
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
getTicks()  : int
isClosed()  : bool
isDirty()  : bool
Returns whether the tile needs to be respawned to viewers.
isRinging()  : bool
onBlockDestroyed()  : void
Called when the tile's block is destroyed.
readSaveData()  : void
saveNBT()  : CompoundTag
setDirty()  : void
setFacing()  : void
setRinging()  : void
setTicks()  : 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_DIRECTION

public mixed TAG_DIRECTION = "Direction"

TAG_ID

public mixed TAG_ID = "id"

TAG_RINGING

public mixed TAG_RINGING = "Ringing"

TAG_TICKS

public mixed TAG_TICKS = "Ticks"

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

$facing

private int $facing = \pocketmine\math\Facing::NORTH

$ringing

private bool $ringing = false

$spawnCompoundCache

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

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

$ticks

private int $ticks = 0

Methods

__destruct()

public __destruct() : mixed
Return values
mixed

close()

public close() : void
Return values
void

createFakeUpdatePacket()

TODO: HACK! Creates a BlockActorDataPacket that triggers the ringing animation on a bell block.

public createFakeUpdatePacket(int $bellHitFace) : BlockActorDataPacket

Bedrock team overcomplicated making bells ring when they implemented this; this would have been better and much simpler as a BlockEventPacket. It's simpler to implement bells with this hack than to follow Mojang's complicated mess.

Parameters
$bellHitFace : int
Return values
BlockActorDataPacket

getFacing()

public getFacing() : int
Return values
int

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

getTicks()

public getTicks() : int
Return values
int

isClosed()

public isClosed() : bool
Return values
bool

isDirty()

Returns whether the tile needs to be respawned to viewers.

public isDirty() : bool
Return values
bool

isRinging()

public isRinging() : 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

setFacing()

public setFacing(int $facing) : void
Parameters
$facing : int
Return values
void

setRinging()

public setRinging(bool $ringing) : void
Parameters
$ringing : bool
Return values
void

setTicks()

public setTicks(int $ticks) : void
Parameters
$ticks : int
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