本文整理汇总了PHP中pocketmine\inventory\InventoryType::get方法的典型用法代码示例。如果您正苦于以下问题:PHP InventoryType::get方法的具体用法?PHP InventoryType::get怎么用?PHP InventoryType::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\inventory\InventoryType
的用法示例。
在下文中一共展示了InventoryType::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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);
}
示例2: __construct
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));
}
}
}
示例3: __construct
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);
}
}
示例4: __construct
/**
* @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);
}
示例5: __construct
public function __construct(Position $pos)
{
parent::__construct(new FakeBlockMenu($this, $pos), InventoryType::get(InventoryType::ANVIL));
}
示例6: __construct
public function __construct(Chest $tile)
{
parent::__construct($tile, InventoryType::get(InventoryType::CHEST));
}
示例7: __construct
public function __construct(Human $player)
{
$this->hotbar = array_fill(0, $this->getHotbarSize(), -1);
parent::__construct($player, InventoryType::get(InventoryType::PLAYER));
}
示例8: __construct
public function __construct($holder, $client)
{
$this->client = $client;
parent::__construct($holder, InventoryType::get(InventoryType::CHEST), [], null, "Trader Inventory");
}
示例9: __construct
public function __construct(BrewingStand $tile)
{
parent::__construct($tile, InventoryType::get(InventoryType::BREWING_STAND));
}
示例10: __construct
public function __construct(EnchantTable $tile)
{
parent::__construct($tile, InventoryType::get(InventoryType::ENCHANT_TABLE));
}
示例11: __construct
public function __construct(Furnace $tile)
{
parent::__construct($tile, InventoryType::get(InventoryType::FURNACE));
}
示例12: __construct
public function __construct(Hopper $tile)
{
parent::__construct($tile, InventoryType::get(InventoryType::HOPPER));
}
示例13: __construct
public function __construct(Chest $left, Chest $right)
{
$this->left = $left->getRealInventory();
$this->right = $right->getRealInventory();
BaseInventory::__construct($this, InventoryType::get(InventoryType::DOUBLE_CHEST));
}
示例14: __construct
public function __construct(Dispenser $tile)
{
parent::__construct($tile, InventoryType::get(InventoryType::DISPENSER));
}
示例15: __construct
public function __construct(InventoryHolder $holder, $name = "Money Account")
{
parent::__construct($holder, clone InventoryType::get(InventoryType::CHEST), [], 36, $name);
}