Dispenser 5.46.0
Extends Opaque
Implements AnyFacing
Dispenser: on a rising redstone edge, waits Dispenser::DISPENSE_DELAY_TICKS game ticks, then uses a random non-empty slot (Minecraft Wiki "Dispenser"). What happens to the item is decided by DispenseBehaviorRegistry.
Constants
DISPENSE_DELAY_TICKS
php
public const DISPENSE_DELAY_TICKS = 42 redstone ticks
Properties
$triggered protected
php
protected bool $triggeredMethods
describeBlockOnlyState() protected
php
protected function describeBlockOnlyState(\pocketmine\data\runtime\RuntimeDataDescriber $w) : voiddispense()
php
public function dispense() : voidDispenses one item from a random non-empty slot. The slot is chosen now, not when the dispenser was powered.
dispenseItem() protected
php
protected function dispenseItem(\pocketmine\block\dispenser\DispenseContext $context, \pocketmine\item\Item $stack) : ?\pocketmine\item\ItemReturns the new contents of the slot, or null if nothing happened.
getPlacementFacing()
php
public static function getPlacementFacing(\pocketmine\math\Vector3 $blockPos, \pocketmine\player\Player $player) : intFacing of a dispenser-like block placed by the given player: towards the player, or up/down when the player stands close and above/below it (same rule as barrels).
isTriggered()
php
public function isTriggered() : boolWhether the dispenser is powered (Bedrock "triggered_bit"). Only a rising edge makes it dispense.
onInteract()
php
public function onInteract(\pocketmine\item\Item $item, int $face, \pocketmine\math\Vector3 $clickVector, ?\pocketmine\player\Player $player = null, array &$returnedItems = []) : boolonNearbyBlockChange()
php
public function onNearbyBlockChange() : voidonScheduledUpdate()
php
public function onScheduledUpdate() : voidplace()
php
public function place(\pocketmine\world\BlockTransaction $tx, \pocketmine\item\Item $item, \pocketmine\block\Block $blockReplace, \pocketmine\block\Block $blockClicked, int $face, \pocketmine\math\Vector3 $clickVector, ?\pocketmine\player\Player $player = null) : boolsetTriggered()
php
public function setTriggered(bool $triggered) : self