get() public static method

public static get ( $index ) : InventoryType
$index
return InventoryType
 public function __construct(Chest $left, Chest $right)
 {
     $this->left = $left->getRealInventory();
     $this->right = $right->getRealInventory();
     $items = array_merge($this->left->getContents(), $this->right->getContents());
     BaseInventory::__construct($this, InventoryType::get(InventoryType::DOUBLE_CHEST), $items);
 }
Esempio n. 2
0
 public function __construct(Human $player, $contents = null)
 {
     $this->hotbar = range(0, $this->getHotbarSize() - 1, 1);
     parent::__construct($player, InventoryType::get(InventoryType::PLAYER));
     if ($contents !== null) {
         if ($contents instanceof ListTag) {
             //Saved data to be loaded into the inventory
             foreach ($contents as $item) {
                 if ($item["Slot"] >= 0 and $item["Slot"] < $this->getHotbarSize()) {
                     //Hotbar
                     if (isset($item["TrueSlot"])) {
                         //Valid slot was found, change the linkage to this slot
                         if (0 <= $item["TrueSlot"] and $item["TrueSlot"] < $this->getSize()) {
                             $this->hotbar[$item["Slot"]] = $item["TrueSlot"];
                         } elseif ($item["TrueSlot"] < 0) {
                             //Link to an empty slot (empty hand)
                             $this->hotbar[$item["Slot"]] = -1;
                         }
                     }
                     /* If TrueSlot is not set, leave the slot index as its default which was filled in above
                      * This only overwrites slot indexes for valid links */
                 } elseif ($item["Slot"] >= 100 and $item["Slot"] < 104) {
                     //Armor
                     $this->setItem($this->getSize() + $item["Slot"] - 100, NBT::getItemHelper($item), false);
                 } else {
                     $this->setItem($item["Slot"] - $this->getHotbarSize(), NBT::getItemHelper($item), false);
                 }
             }
         } else {
             throw new \InvalidArgumentException("Expecting ListTag, received " . gettype($contents));
         }
     }
 }
 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(Position $pos)
 {
     parent::__construct(new FakeBlockMenu($this, $pos), InventoryType::get(InventoryType::ANVIL));
 }
 public function __construct(Chest $tile)
 {
     parent::__construct($tile, InventoryType::get(InventoryType::CHEST));
 }
Esempio n. 7
0
 public function __construct(Human $player)
 {
     $this->hotbar = array_fill(0, $this->getHotbarSize(), -1);
     parent::__construct($player, InventoryType::get(InventoryType::PLAYER));
 }
Esempio n. 8
0
 public function __construct($holder, $client)
 {
     $this->client = $client;
     parent::__construct($holder, InventoryType::get(InventoryType::CHEST), [], null, "Trader Inventory");
 }
Esempio n. 9
0
 public function __construct(BrewingStand $tile)
 {
     parent::__construct($tile, InventoryType::get(InventoryType::BREWING_STAND));
 }
Esempio n. 10
0
 public function __construct(EnchantTable $tile)
 {
     parent::__construct($tile, InventoryType::get(InventoryType::ENCHANT_TABLE));
 }
Esempio n. 11
0
 public function __construct(Furnace $tile)
 {
     parent::__construct($tile, InventoryType::get(InventoryType::FURNACE));
 }
Esempio n. 12
0
 public function __construct(Hopper $tile)
 {
     parent::__construct($tile, InventoryType::get(InventoryType::HOPPER));
 }
Esempio n. 13
0
 public function __construct(Chest $left, Chest $right)
 {
     $this->left = $left->getRealInventory();
     $this->right = $right->getRealInventory();
     BaseInventory::__construct($this, InventoryType::get(InventoryType::DOUBLE_CHEST));
 }
Esempio n. 14
0
 public function __construct(Dispenser $tile)
 {
     parent::__construct($tile, InventoryType::get(InventoryType::DISPENSER));
 }
Esempio n. 15
0
 public function __construct(InventoryHolder $holder, $name = "Money Account")
 {
     parent::__construct($holder, clone InventoryType::get(InventoryType::CHEST), [], 36, $name);
 }