Skip to content

ComparatorReadableContainerTrait 5.46.0 ​

trait · pocketmine\block\tile\ComparatorReadableContainerTrait · source

Implements ComparatorReadableContainer for container tiles: the output follows the fullness of the inventory, and comparators and nearby hoppers are told when the contents change.

Methods ​

addComparatorInventoryListener() protected ​

php
protected function addComparatorInventoryListener() : void

Call this from the tile constructor, after the inventory is created.

calculateComparatorOutput() ​

php
public static function calculateComparatorOutput(\pocketmine\inventory\Inventory $inventory) : int

Vanilla formula: 0 when empty, otherwise 1 + floor(14 * average slot fullness).

getComparatorOutput() ​

php
public function getComparatorOutput() : int

getPosition() protected ​

php
abstract protected function getPosition() : \pocketmine\world\Position

getRealInventory() ​

php
abstract public function getRealInventory() : \pocketmine\inventory\Inventory

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