Skip to content

Crafter 5.46.0 ​

class · pocketmine\block\tile\Crafter · source

Extends Spawnable
Implements ComparatorReadableContainer, Nameable

Block entity of crafters ("Crafter").

Saved data: Items (slots 0-8) and disabled_slots (TAG_Short bit mask, bit N = slot N), per the Minecraft Wiki "Bedrock Edition level format/Block entity format" and GeyserMC CrafterInventoryTranslator.

Constants ​

TAG_DISABLED_SLOTS ​

php
public const TAG_DISABLED_SLOTS = "disabled_slots"

Properties ​

$inventory protected ​

php
protected \pocketmine\block\inventory\CrafterInventory $inventory

Methods ​

__construct() ​

php
public function __construct(\pocketmine\world\World $world, \pocketmine\math\Vector3 $pos)

addAdditionalSpawnData() protected ​

php
protected function addAdditionalSpawnData(\pocketmine\nbt\tag\CompoundTag $nbt) : void

close() ​

php
public function close() : void

getComparatorOutput() ​

php
public function getComparatorOutput() : int

Vanilla: the number of slots which are disabled or hold an item, whatever the stack sizes.

getCraftAtTick() ​

php
public function getCraftAtTick() : ?int

getCraftingUntilTick() ​

php
public function getCraftingUntilTick() : int

getDefaultName() ​

php
public function getDefaultName() : string

getInsertSlotFor() ​

php
public function getInsertSlotFor(\pocketmine\item\Item $item) : ?int

Returns the slot a hopper or dropper puts the given item into, or null if no enabled slot can take it. Vanilla: the first empty enabled slot, otherwise the matching stack with the lowest count (earliest on ties).

getInventory() ​

php
public function getInventory() : \pocketmine\block\inventory\CrafterInventory

getRealInventory() ​

php
public function getRealInventory() : \pocketmine\block\inventory\CrafterInventory

readSaveData() ​

php
public function readSaveData(\pocketmine\nbt\tag\CompoundTag $nbt) : void

setCraftAtTick() ​

php
public function setCraftAtTick(?int $tick) : void

setCraftingUntilTick() ​

php
public function setCraftingUntilTick(int $tick) : void

setSlotDisabled() ​

php
public function setSlotDisabled(int $slot, bool $disabled) : bool

Toggles a slot and tells clients and comparators. Returns false if the slot could not be changed (it holds an item).

writeSaveData() protected ​

php
protected function writeSaveData(\pocketmine\nbt\tag\CompoundTag $nbt) : void

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