public function __construct(Player $p) { parent::__construct($p, InventoryType::get(2)); $inv = $p->getInventory(); $this->setContents($inv->getContents()); $this->armor = $inv->getArmorContents(); for ($i = 0; $i < 10; $i++) { $this->hotbar[$i] = $inv->getHotbarSlotIndex($i); } }
/** * @param DeFactoGui $main * @param Button[] $buttons - list of buttons to display in the chest. * @param int $size default 127 - size of the inventory. * @param string|null $title - unused. */ public function __construct(DeFactoGui $main, $buttons = [], $size = 127, $title = null) { $this->main = $main; $this->buttons = $buttons; if ($size < count($buttons)) { throw new \InvalidArgumentException("InteractiveInventory size is less than count of buttons passed"); } /** @var Item[] $items */ $items = array_map(function (Button $button) { return $button->onLoad($this); }, $buttons); parent::__construct($main->getFakeTile(), InventoryType::get(InventoryType::CHEST), $items, $size, $title); }
public function __construct($holder, $client) { $this->client = $client; parent::__construct($holder, InventoryType::get(InventoryType::CHEST), [], null, "Trader Inventory"); }
public function __construct(InventoryHolder $holder, $name = "Money Account") { parent::__construct($holder, clone InventoryType::get(InventoryType::CHEST), [], 36, $name); }