Skip to content

DispenseBehaviorRegistry 5.46.0 ​

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

Chooses what a dispenser does with each item. Items without a registered behaviour are dropped.

Behaviours follow the Minecraft Wiki "Dispenser" page (Bedrock): projectiles are shot, liquids and blocks are placed, tools are used on the block in front, armor is equipped on a mob or player in front. Items whose entities or targets don't exist on this server (saddles, sheep shearing...) are dropped or do nothing. Minecarts are put on the rail in front (or below the block in front), boats on the water in front.

Methods ​

__construct() ​

php
public function __construct()

get() ​

php
public function get(\pocketmine\item\Item $item) : \pocketmine\block\dispenser\DispenseBehavior

getDefault() ​

php
public function getDefault() : \pocketmine\block\dispenser\DispenseBehavior

register() ​

php
public function register(int $itemTypeId, \pocketmine\block\dispenser\DispenseBehavior $behavior) : void

Sets the behaviour of an item type, replacing any previous one.

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