PocketMine-MP 5.15.1 git-fb9a74e8799c71ed8292cfa53abe7a4c9204629d
pocketmine\block\tile\Bell Class Reference
+ Inheritance diagram for pocketmine\block\tile\Bell:
+ Collaboration diagram for pocketmine\block\tile\Bell:

Public Member Functions

 clearSpawnCompoundCache ()
 close ()
 copyDataFromItem (Item $item)
 createFakeUpdatePacket (int $bellHitFace)
 getBlock ()
 getCleanedNBT ()
 getFacing ()
 getPosition ()
 getRenderUpdateBugWorkaroundStateProperties (Block $block)
 getSerializedSpawnCompound ()
 getSpawnCompound ()
 getTicks ()
 isClosed ()
 isDirty ()
 isRinging ()
 onBlockDestroyed ()
 readSaveData (CompoundTag $nbt)
 saveNBT ()
 setDirty (bool $dirty=true)
 setFacing (int $facing)
 setRinging (bool $ringing)
 setTicks (int $ticks)

Public Attributes

bool $closed = false
const TAG_DIRECTION = "Direction"
const TAG_ID = "id"
const TAG_RINGING = "Ringing"
const TAG_TICKS = "Ticks"
const TAG_X = "x"
const TAG_Y = "y"
const TAG_Z = "z"

Protected Member Functions

 addAdditionalSpawnData (CompoundTag $nbt)
 onBlockDestroyedHook ()
 writeSaveData (CompoundTag $nbt)

Protected Attributes

Position $position
TimingsHandler $timings

Detailed Description

Definition at line 33 of file tile/Bell.php.

Member Function Documentation

◆ addAdditionalSpawnData()

pocketmine\block\tile\Bell::addAdditionalSpawnData ( CompoundTag  $nbt)

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

Reimplemented from pocketmine\block\tile\Spawnable.

Definition at line 54 of file tile/Bell.php.

◆ clearSpawnCompoundCache()

pocketmine\block\tile\Spawnable::clearSpawnCompoundCache ( )

Definition at line 52 of file Spawnable.php.

◆ close()

pocketmine\block\tile\Tile::close ( )

Definition at line 129 of file Tile.php.

◆ copyDataFromItem()

pocketmine\block\tile\Tile::copyDataFromItem ( Item  $item)

Definition at line 92 of file Tile.php.

◆ createFakeUpdatePacket()

pocketmine\block\tile\Bell::createFakeUpdatePacket ( int  $bellHitFace)

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

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.

Definition at line 80 of file tile/Bell.php.

◆ getBlock()

pocketmine\block\tile\Tile::getBlock ( )

Definition at line 98 of file Tile.php.

◆ getCleanedNBT()

pocketmine\block\tile\Tile::getCleanedNBT ( )

Definition at line 82 of file Tile.php.

◆ getFacing()

pocketmine\block\tile\Bell::getFacing ( )

Definition at line 46 of file tile/Bell.php.

◆ getPosition()

pocketmine\block\tile\Tile::getPosition ( )

Definition at line 102 of file Tile.php.

◆ getRenderUpdateBugWorkaroundStateProperties()

pocketmine\block\tile\Spawnable::getRenderUpdateBugWorkaroundStateProperties ( Block  $block)

The Bedrock client won't re-render a block if the block's state properties didn't change. This is a problem when the tile may affect the block's appearance. For example, a cauldron's liquid changes colour based on the dye inside.

This is worked around in vanilla by modifying one of the block's state properties to a different value, and then changing it back again. Since we don't want to litter core implementation with hacks like this, we brush it under the rug into Tile.

ByteTag[]|IntTag[]|StringTag[] @phpstan-return array<string, IntTag|StringTag|ByteTag>

Reimplemented in pocketmine\block\tile\Cauldron, and pocketmine\block\tile\FlowerPot.

Definition at line 68 of file Spawnable.php.

◆ getSerializedSpawnCompound()

pocketmine\block\tile\Spawnable::getSerializedSpawnCompound ( )

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

@phpstan-return CacheableNbt<\pocketmine\nbt\tag\CompoundTag>

Definition at line 78 of file Spawnable.php.

◆ getSpawnCompound()

pocketmine\block\tile\Spawnable::getSpawnCompound ( )

Definition at line 86 of file Spawnable.php.

◆ getTicks()

pocketmine\block\tile\Bell::getTicks ( )

Definition at line 50 of file tile/Bell.php.

◆ isClosed()

pocketmine\block\tile\Tile::isClosed ( )

Definition at line 106 of file Tile.php.

◆ isDirty()

pocketmine\block\tile\Spawnable::isDirty ( )

Definition at line 41 of file Spawnable.php.

◆ isRinging()

pocketmine\block\tile\Bell::isRinging ( )

Definition at line 42 of file tile/Bell.php.

◆ onBlockDestroyed()

pocketmine\block\tile\Tile::onBlockDestroyed ( )

Called when the tile's block is destroyed.

Definition at line 117 of file Tile.php.

References pocketmine\block\tile\onBlockDestroyedHook().

+ Here is the call graph for this function:

◆ onBlockDestroyedHook()

pocketmine\block\tile\Tile::onBlockDestroyedHook ( )

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

Reimplemented in pocketmine\block\tile\Chest, pocketmine\block\tile\Jukebox, and pocketmine\block\tile\ShulkerBox.

Definition at line 125 of file Tile.php.

◆ readSaveData()

pocketmine\block\tile\Bell::readSaveData ( CompoundTag  $nbt)

Reimplemented from pocketmine\block\tile\Tile.

Definition at line 60 of file tile/Bell.php.

◆ saveNBT()

pocketmine\block\tile\Tile::saveNBT ( )

Definition at line 70 of file Tile.php.

◆ setDirty()

pocketmine\block\tile\Spawnable::setDirty ( bool  $dirty = true)

Definition at line 48 of file Spawnable.php.

◆ setFacing()

pocketmine\block\tile\Bell::setFacing ( int  $facing)

Definition at line 48 of file tile/Bell.php.

◆ setRinging()

pocketmine\block\tile\Bell::setRinging ( bool  $ringing)

Definition at line 44 of file tile/Bell.php.

◆ setTicks()

pocketmine\block\tile\Bell::setTicks ( int  $ticks)

Definition at line 52 of file tile/Bell.php.

◆ writeSaveData()

pocketmine\block\tile\Bell::writeSaveData ( CompoundTag  $nbt)

Writes additional save data to a CompoundTag, not including generic things like ID and coordinates.

Reimplemented from pocketmine\block\tile\Tile.

Definition at line 66 of file tile/Bell.php.

Member Data Documentation

◆ $closed

bool pocketmine\block\tile\Tile::$closed = false

Definition at line 50 of file Tile.php.

◆ $position

Position pocketmine\block\tile\Tile::$position

Definition at line 49 of file Tile.php.

◆ $timings

TimingsHandler pocketmine\block\tile\Tile::$timings

Definition at line 51 of file Tile.php.


const pocketmine\block\tile\Bell::TAG_DIRECTION = "Direction"

Definition at line 34 of file tile/Bell.php.


const pocketmine\block\tile\Tile::TAG_ID = "id"

Definition at line 44 of file Tile.php.


const pocketmine\block\tile\Bell::TAG_RINGING = "Ringing"

Definition at line 35 of file tile/Bell.php.


const pocketmine\block\tile\Bell::TAG_TICKS = "Ticks"

Definition at line 36 of file tile/Bell.php.


const pocketmine\block\tile\Tile::TAG_X = "x"

Definition at line 45 of file Tile.php.


const pocketmine\block\tile\Tile::TAG_Y = "y"

Definition at line 46 of file Tile.php.


const pocketmine\block\tile\Tile::TAG_Z = "z"

Definition at line 47 of file Tile.php.

The documentation for this class was generated from the following file: