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


PHP Item::getCompoundTag方法代码示例

本文整理汇总了PHP中pocketmine\item\Item::getCompoundTag方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::getCompoundTag方法的具体用法?PHP Item::getCompoundTag怎么用?PHP Item::getCompoundTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\item\Item的用法示例。


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

示例1: equals

 public final function equals(Item $item, $checkDamage = true, $checkCompound = true)
 {
     return $this->id === $item->getId() and ($checkDamage === false or $this->getDamage() === $item->getDamage()) and ($checkCompound === false or $this->getCompoundTag() === $item->getCompoundTag());
 }
开发者ID:maa123,项目名称:NIGHTMARE,代码行数:4,代码来源:Item.php

示例2: putSlot

 public function putSlot(Item $item)
 {
     if ($item->getId() === 0) {
         $this->putShort(0);
         return;
     }
     $this->putShort($item->getId());
     $this->putByte($item->getCount());
     $this->putShort($item->getDamage() === null ? -1 : $item->getDamage());
     $nbt = $item->getCompoundTag();
     $this->putLShort(strlen($nbt));
     $this->put($nbt);
 }
开发者ID:Cecil107,项目名称:PocketMine-0.13.0,代码行数:13,代码来源:BinaryStream.php

示例3: first

 public function first(Item $item)
 {
     $count = \max(1, $item->getCount());
     $checkDamage = $item->getDamage() === \null ? \false : \true;
     $checkTags = $item->getCompoundTag() === \null ? \false : \true;
     foreach ($this->getContents() as $index => $i) {
         if ($item->equals($i, $checkDamage, $checkTags) and $i->getCount() >= $count) {
             return $index;
         }
     }
     return -1;
 }
开发者ID:kazuemon,项目名称:NIGHTMARE,代码行数:12,代码来源:BaseInventory.php

示例4: putSlot

 public function putSlot(Item $item)
 {
     if ($item->getId() === 0) {
         $this->buffer .= \pack("n", 0);
         return;
     }
     $this->buffer .= \pack("n", $item->getId());
     $this->buffer .= \chr($item->getCount());
     $this->buffer .= \pack("n", $item->getDamage() === \null ? -1 : $item->getDamage());
     $nbt = $item->getCompoundTag();
     $this->buffer .= \pack("n", \strlen($nbt));
     $this->buffer .= $nbt;
 }
开发者ID:ken77731,项目名称:PocketMine-0.13.0,代码行数:13,代码来源:BinaryStream__64bit.php

示例5: putSlot

 protected function putSlot(Item $item)
 {
     if ($item->getID() === 0) {
         $this->putShort(-1);
     } else {
         $this->putShort($item->getID());
         $this->putByte($item->getCount());
         $this->putShort($item->getDamage());
         $nbt = $item->getCompoundTag();
         $this->putByte(strlen($nbt));
         $this->put($nbt);
     }
 }
开发者ID:iPocketTeam,项目名称:BigBrother,代码行数:13,代码来源:Packet.php

示例6: putSlot

 public function putSlot(Item $item)
 {
     if ($item->getId() === 0) {
         $this->putVarInt(0);
         return;
     }
     $this->putVarInt($item->getId());
     $auxValue = ($item->getDamage() ?? -1) << 8 | $item->getCount();
     $this->putVarInt($auxValue);
     $nbt = $item->getCompoundTag();
     $this->putLShort(strlen($nbt));
     $this->put($nbt);
 }
开发者ID:robske110,项目名称:ClearSky,代码行数:13,代码来源:BinaryStream.php


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