本文整理汇总了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());
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}