public static putItemHelper ( |
||
$item | ||
$slot | integer | |
Результат |
public static function putItemHelper(Item $item, $slot = null)
{
$tag = new CompoundTag(null, ["id" => new ShortTag("id", $item->getId()), "Count" => new ByteTag("Count", $item->getCount()), "Damage" => new ShortTag("Damage", $item->getDamage())]);
if ($slot !== null) {
$tag->Slot = new ByteTag("Slot", (int) $slot);
}
if ($item->hasCompoundTag()) {
$tag->tag = clone $item->getNamedTag();
$tag->tag->setName("tag");
}
return $tag;
}
public function setItem(Item $item, bool $setChanged = true) { $nbtItem = NBT::putItemHelper($item); $nbtItem->setName("Item"); $this->namedtag->Item = $nbtItem; if ($setChanged) { $this->setChanged(); } }