ComparatorReadableContainerTrait 5.46.0
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() : voidCall this from the tile constructor, after the inventory is created.
calculateComparatorOutput()
php
public static function calculateComparatorOutput(\pocketmine\inventory\Inventory $inventory) : intVanilla formula: 0 when empty, otherwise 1 + floor(14 * average slot fullness).
getComparatorOutput()
php
public function getComparatorOutput() : intgetPosition() protected
php
abstract protected function getPosition() : \pocketmine\world\PositiongetRealInventory()
php
abstract public function getRealInventory() : \pocketmine\inventory\Inventory