Skip to content

Shelf 5.46.0 ​

class · pocketmine\block\Shelf · source

Extends Transparent
Implements HorizontalFacing, PoweredByRedstone

Wooden shelf (Bedrock 1.21.110+). Displays up to three item stacks on its front.

Unpowered: using the front face swaps the held item with the clicked slot (in creative the held item is copied into the slot instead, unless the hand is empty). Powered: the shelf joins adjacent powered shelves facing the same way into chains of up to three (filled from the left as seen from the front), and using any shelf of a chain swaps the whole chain with the rightmost 3, 6 or 9 hotbar slots.

PocketMine has no redstone propagation, so the powered state only changes when set by a plugin or loaded from a world; the chain shape (powered_shelf_type) is recalculated from the neighbouring shelves.

Constants ​

MAX_CHAIN_LENGTH ​

php
public const MAX_CHAIN_LENGTH = 3

Properties ​

$chainPart protected ​

php
protected \pocketmine\block\utils\ShelfChainPart $chainPart

Methods ​

describeBlockOnlyState() protected ​

php
protected function describeBlockOnlyState(\pocketmine\data\runtime\RuntimeDataDescriber $w) : void

getChain() ​

php
public function getChain() : array

Returns the powered shelves of this shelf's chain, ordered from left to right (as seen from the front). Rows of adjacent powered shelves are split into chains of three starting from the left.

getChainPart() ​

php
public function getChainPart() : \pocketmine\block\utils\ShelfChainPart

getFlameEncouragement() ​

php
public function getFlameEncouragement() : int

getFlammability() ​

php
public function getFlammability() : int

isAffectedBySilkTouch() ​

php
public function isAffectedBySilkTouch() : bool

onInteract() ​

php
public function onInteract(\pocketmine\item\Item $item, int $face, \pocketmine\math\Vector3 $clickVector, ?\pocketmine\player\Player $player = null, array &$returnedItems = []) : bool

onNearbyBlockChange() ​

php
public function onNearbyBlockChange() : void

setChainPart() ​

php
public function setChainPart(\pocketmine\block\utils\ShelfChainPart $chainPart) : self

Sets the displayed chain shape. This is normally recalculated automatically from the neighbouring shelves.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.