当前位置: 首页>>代码示例>>PHP>>正文


PHP InventoryType::get方法代码示例

本文整理汇总了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);
 }
开发者ID:psh3253,项目名称:PocketMine-MP_Windows,代码行数:7,代码来源:DoubleChestInventory.php

示例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));
         }
     }
 }
开发者ID:robske110,项目名称:ClearSky,代码行数:33,代码来源:PlayerInventory.php

示例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);
     }
 }
开发者ID:Mike1150,项目名称:SurvivalGames,代码行数:10,代码来源:VirtualInventory.php

示例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);
 }
开发者ID:barnseyminesuk,项目名称:Small-ZC-Plugins,代码行数:19,代码来源:InteractiveInventory.php

示例5: __construct

 public function __construct(Position $pos)
 {
     parent::__construct(new FakeBlockMenu($this, $pos), InventoryType::get(InventoryType::ANVIL));
 }
开发者ID:NewDelion,项目名称:PocketMine-0.13.x,代码行数:4,代码来源:AnvilInventory.php

示例6: __construct

 public function __construct(Chest $tile)
 {
     parent::__construct($tile, InventoryType::get(InventoryType::CHEST));
 }
开发者ID:mattiasaxelsson,项目名称:PocketMine-MP,代码行数:4,代码来源:ChestInventory.php

示例7: __construct

 public function __construct(Human $player)
 {
     $this->hotbar = array_fill(0, $this->getHotbarSize(), -1);
     parent::__construct($player, InventoryType::get(InventoryType::PLAYER));
 }
开发者ID:boybook,项目名称:PocketMine-MP,代码行数:5,代码来源:PlayerInventory.php

示例8: __construct

 public function __construct($holder, $client)
 {
     $this->client = $client;
     parent::__construct($holder, InventoryType::get(InventoryType::CHEST), [], null, "Trader Inventory");
 }
开发者ID:Gabriel865,项目名称:pocketmine-plugins,代码行数:5,代码来源:ShopKeep.php

示例9: __construct

 public function __construct(BrewingStand $tile)
 {
     parent::__construct($tile, InventoryType::get(InventoryType::BREWING_STAND));
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:4,代码来源:BrewingInventory.php

示例10: __construct

 public function __construct(EnchantTable $tile)
 {
     parent::__construct($tile, InventoryType::get(InventoryType::ENCHANT_TABLE));
 }
开发者ID:xpyctum,项目名称:Genisys,代码行数:4,代码来源:EnchantInventory.php

示例11: __construct

 public function __construct(Furnace $tile)
 {
     parent::__construct($tile, InventoryType::get(InventoryType::FURNACE));
 }
开发者ID:TexusDark,项目名称:Ananas-MP,代码行数:4,代码来源:FurnaceInventory.php

示例12: __construct

 public function __construct(Hopper $tile)
 {
     parent::__construct($tile, InventoryType::get(InventoryType::HOPPER));
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:4,代码来源:HopperInventory.php

示例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));
 }
开发者ID:rryy,项目名称:PocketMine-MP,代码行数:6,代码来源:DoubleChestInventory.php

示例14: __construct

 public function __construct(Dispenser $tile)
 {
     parent::__construct($tile, InventoryType::get(InventoryType::DISPENSER));
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:4,代码来源:DispenserInventory.php

示例15: __construct

 public function __construct(InventoryHolder $holder, $name = "Money Account")
 {
     parent::__construct($holder, clone InventoryType::get(InventoryType::CHEST), [], 36, $name);
 }
开发者ID:MCPEGamerJPatGitHub,项目名称:xEcon,代码行数:4,代码来源:DummyInventory.php


注:本文中的pocketmine\inventory\InventoryType::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。