本文整理匯總了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);
}