Skip to content

DispenseContext 5.46.0 ​

final class · pocketmine\block\dispenser\DispenseContext · source

A dispenser (or dropper, or crafter) about to dispense an item.

Methods ​

__construct() ​

php
public function __construct(\pocketmine\world\World $world, \pocketmine\math\Vector3 $position, int $facing, \pocketmine\inventory\Inventory $inventory)

addOrDrop() ​

php
public function addOrDrop(\pocketmine\item\Item $item) : void

Puts an item produced while dispensing back into the dispenser, or drops it in front if it doesn't fit.

getDispensePosition() ​

php
public function getDispensePosition() : \pocketmine\math\Vector3

Point items and projectiles come out of: 0.7 blocks from the centre of the dispenser, towards its front.

getFacing() ​

php
public function getFacing() : int

Direction the dispenser faces.

getInventory() ​

php
public function getInventory() : \pocketmine\inventory\Inventory

getPosition() ​

php
public function getPosition() : \pocketmine\math\Vector3

Position of the dispensing block.

getTargetBlock() ​

php
public function getTargetBlock() : \pocketmine\block\Block

getTargetPosition() ​

php
public function getTargetPosition() : \pocketmine\math\Vector3

Position of the block in front of the dispenser.

getWorld() ​

php
public function getWorld() : \pocketmine\world\World

nextGaussian() ​

php
public static function nextGaussian() : float

Normally distributed random number (mean 0, standard deviation 1).

playEffects() ​

php
public function playEffects(?\pocketmine\world\sound\Sound $sound = null) : void

Plays the sound and smoke puff of a successful dispense.

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