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


PHP inventory\Inventory类代码示例

本文整理汇总了PHP中pocketmine\inventory\Inventory的典型用法代码示例。如果您正苦于以下问题:PHP Inventory类的具体用法?PHP Inventory怎么用?PHP Inventory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Inventory类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addToInventory

 /**
  * @param Inventory $inventory
  */
 public function addToInventory(Inventory $inventory)
 {
     foreach ($this->getItems() as $i) {
         $inventory->setItem($inventory->firstEmpty(), clone $i);
     }
     // call_user_func_array($inventory->addItem(), $this->getItems());
 }
开发者ID:PrimusLV,项目名称:EssentialsPE,代码行数:10,代码来源:BaseKit.php

示例2: addInventoryRandomItems

 public function addInventoryRandomItems($level, Inventory $inv)
 {
     if ($inv != null) {
         $inv->setItem(0, self::randomItems());
         $inv->setItem(1, self::randomItems());
         $inv->setItem(2, self::randomItems());
         $inv->setItem(3, self::randomItems());
     }
 }
开发者ID:Ragnok123,项目名称:CSCase,代码行数:9,代码来源:ChestInventory.php

示例3: sendSlotUpdate

 /**
  * @param Player $source
  *
  * Sends a slot update to inventory viewers
  * For successful transactions, update non-source viewers (source does not need updating)
  * For failed transactions, update the source (non-source viewers will see nothing anyway)
  */
 public function sendSlotUpdate(Player $source)
 {
     if ($this->getInventory() instanceof TemporaryInventory) {
         return;
     }
     $targets = [];
     if ($this->wasSuccessful) {
         $targets = $this->getInventory()->getViewers();
         unset($targets[spl_object_hash($source)]);
     } else {
         $targets = [$source];
     }
     $this->inventory->sendSlot($this->slot, $targets);
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:21,代码来源:BaseTransaction.php

示例4: loadInventory

 public function loadInventory(Player $player, Inventory $inv)
 {
     $n = trim(strtolower($player->getName()));
     if ($n === "") {
         return false;
     }
     if ($this->isGlobal) {
         $ln = "*";
     } else {
         $ln = trim(strtolower($player->getLevel()->getName()));
     }
     $inv->clearAll();
     $sql = "SELECT slot,id,damage,count FROM NetherChests WHERE player = " . $this->prepare($n) . " AND world = " . $this->prepare($ln);
     $res = $this->database->query($sql);
     if ($res === false) {
         return false;
     }
     while (($row = $res->fetch_assoc()) != null) {
         $inv->setItem($row["slot"], Item::get($row["id"], $row["damage"], $row["count"]));
     }
     $res->free();
     return true;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:23,代码来源:MySqlMgr.php

示例5: removeWindow

 public function removeWindow(Inventory $inventory)
 {
     $inventory->close($this);
     if ($this->windows->contains($inventory)) {
         $id = $this->windows[$inventory];
         $this->windows->detach($this->windowIndex[$id]);
         unset($this->windowIndex[$id]);
     }
 }
开发者ID:NewDelion,项目名称:PocketMine-0.13.x,代码行数:9,代码来源:Player.php

示例6: isNeChest

 public function isNeChest(Inventory $inv)
 {
     if ($inv instanceof DoubleChestInventory) {
         return false;
     }
     if (!$inv instanceof ChestInventory) {
         return false;
     }
     $tile = $inv->getHolder();
     if (!$tile instanceof Chest) {
         return false;
     }
     $bl = $tile->getBlock();
     if ($bl->getId() != Block::CHEST) {
         return false;
     }
     if ($bl->getSide(Vector3::SIDE_DOWN)->getId() != $this->base_block) {
         return false;
     }
     return true;
 }
开发者ID:Gabriel865,项目名称:pocketmine-plugins,代码行数:21,代码来源:Main.php

示例7: deleteChest

 public function deleteChest(Inventory $inv)
 {
     $bl = $inv->getHolder()->getBlock();
     $x = $bl->getFloorX();
     $y = $bl->getFloorY();
     $z = $bl->getFloorZ();
     unset($this->chests[$x . ":" . $y . ":" . $z]);
     //	$this->getLogger()->info('Chest deleted');
 }
开发者ID:xHFx,项目名称:TreasureHunt-,代码行数:9,代码来源:Main.php

示例8: getViewers

 /**
  * @return \pocketmine\entity\Human[]
  */
 public function getViewers()
 {
     return $this->inventory->getViewers();
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:7,代码来源:InventoryEvent.php

示例9: loadInventory

 public function loadInventory(Player $player, Inventory $inv)
 {
     $n = trim(strtolower($player->getName()));
     if ($n === "") {
         return false;
     }
     $d = substr($n, 0, 1);
     $path = $this->getDataFolder() . $d . "/" . $n . ".yml";
     if (!is_file($path)) {
         return false;
     }
     $cfg = new Config($path, Config::YAML);
     $yaml = $cfg->getAll();
     if ($this->isGlobal) {
         $ln = "*";
     } else {
         $ln = trim(strtolower($player->getLevel()->getName()));
     }
     if (!isset($yaml[$ln])) {
         return false;
     }
     $inv->clearAll();
     foreach ($yaml[$ln] as $slot => $t) {
         list($id, $dam, $cnt) = explode(":", $t);
         $item = Item::get($id, $dam, $cnt);
         $inv->setItem($slot, $item);
     }
     return true;
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:29,代码来源:YamlMgr.php


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