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

Public Member Functions

 __construct (World $world, Vector3 $pos)
 canOpenWith (string $key)
 clearSpawnCompoundCache ()
 close ()
 copyDataFromItem (Item $item)
 getBlock ()
 getCleanedNBT ()
 getDefaultName ()
 getInventory ()
 getName ()
 getPair ()
 getPosition ()
 getRealInventory ()
 getRenderUpdateBugWorkaroundStateProperties (Block $block)
 getSerializedSpawnCompound ()
 getSpawnCompound ()
 hasName ()
 isClosed ()
 isDirty ()
 isPaired ()
 onBlockDestroyed ()
 pairWith (Chest $tile)
 readSaveData (CompoundTag $nbt)
 saveNBT ()
 setDirty (bool $dirty=true)
 setName (string $str)
 unpair ()

Public Attributes

bool $closed = false
const TAG_CUSTOM_NAME = "CustomName"
const TAG_ID = "id"
const TAG_ITEMS = "Items"
const TAG_LOCK = "Lock"
const TAG_PAIR_LEAD = "pairlead"
const TAG_PAIRX = "pairx"
const TAG_PAIRZ = "pairz"
const TAG_X = "x"
const TAG_Y = "y"
const TAG_Z = "z"

Protected Member Functions

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

Protected Attributes

DoubleChestInventory $doubleInventory = null
ChestInventory $inventory
Position $position
TimingsHandler $timings

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

pocketmine\block\tile\Chest::__construct ( World  $world,
Vector3  $pos 

Reimplemented from pocketmine\block\tile\Tile.

Definition at line 53 of file tile/Chest.php.

Member Function Documentation

◆ addAdditionalSpawnData()

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

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

Reimplemented from pocketmine\block\tile\Spawnable.

Definition at line 216 of file tile/Chest.php.

References pocketmine\nbt\tag\CompoundTag\setInt().

+ Here is the call graph for this function:

◆ canOpenWith()

pocketmine\block\tile\Container::canOpenWith ( string  $key)

Returns whether this container can be opened by an item with the given custom name.

◆ checkPairing()

pocketmine\block\tile\Chest::checkPairing ( )

Definition at line 128 of file tile/Chest.php.

◆ clearSpawnCompoundCache()

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

Definition at line 52 of file Spawnable.php.

◆ close()

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

Reimplemented from pocketmine\block\tile\Tile.

Definition at line 94 of file tile/Chest.php.

◆ copyDataFromItem()

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

Definition at line 92 of file Tile.php.

◆ getBlock()

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

Definition at line 98 of file Tile.php.

◆ getCleanedNBT()

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

Reimplemented from pocketmine\block\tile\Tile.

Definition at line 85 of file tile/Chest.php.

◆ getDefaultName()

pocketmine\block\tile\Chest::getDefaultName ( )

Implements pocketmine\block\tile\Nameable.

Definition at line 155 of file tile/Chest.php.

◆ getInventory()

pocketmine\block\tile\Chest::getInventory ( )

Implements pocketmine\inventory\InventoryHolder.

Definition at line 117 of file tile/Chest.php.

◆ getPair()

pocketmine\block\tile\Chest::getPair ( )

Definition at line 163 of file tile/Chest.php.

◆ getPosition()

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

Definition at line 102 of file Tile.php.

◆ getRealInventory()

pocketmine\block\tile\Chest::getRealInventory ( )

Implements pocketmine\block\tile\Container.

Definition at line 124 of file tile/Chest.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.

◆ 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.

◆ isPaired()

pocketmine\block\tile\Chest::isPaired ( )

Definition at line 159 of file tile/Chest.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\Chest::onBlockDestroyedHook ( )

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

Reimplemented from pocketmine\block\tile\Tile.

Definition at line 112 of file tile/Chest.php.

◆ pairWith()

pocketmine\block\tile\Chest::pairWith ( Chest  $tile)

Definition at line 174 of file tile/Chest.php.

◆ readSaveData()

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

Reimplemented from pocketmine\block\tile\Tile.

Definition at line 58 of file tile/Chest.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.

◆ unpair()

pocketmine\block\tile\Chest::unpair ( )

Definition at line 196 of file tile/Chest.php.

◆ writeSaveData()

pocketmine\block\tile\Chest::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 76 of file tile/Chest.php.

References pocketmine\nbt\tag\CompoundTag\setInt().

+ Here is the call graph for this function:

Member Data Documentation

◆ $closed

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

Definition at line 50 of file Tile.php.

◆ $doubleInventory

DoubleChestInventory pocketmine\block\tile\Chest::$doubleInventory = null

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

◆ $inventory

ChestInventory pocketmine\block\tile\Chest::$inventory

Definition at line 47 of file tile/Chest.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\Nameable::TAG_CUSTOM_NAME = "CustomName"

Definition at line 27 of file Nameable.php.


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

Definition at line 44 of file Tile.php.


const pocketmine\block\tile\Container::TAG_ITEMS = "Items"

Definition at line 30 of file Container.php.


const pocketmine\block\tile\Container::TAG_LOCK = "Lock"

Definition at line 31 of file Container.php.


const pocketmine\block\tile\Chest::TAG_PAIR_LEAD = "pairlead"

Definition at line 45 of file tile/Chest.php.


const pocketmine\block\tile\Chest::TAG_PAIRX = "pairx"

Definition at line 43 of file tile/Chest.php.


const pocketmine\block\tile\Chest::TAG_PAIRZ = "pairz"

Definition at line 44 of file tile/Chest.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: