/** * @param Item $item * @param int $slot * @return CompoundTag */ 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 static function clearCustomColorToArmor(Item $item) { if (!$item->hasCompoundTag()) { return; } $tag = $item->getNamedTag(); if (isset($tag->customColor)) { unset($tag->customColor); } $item->setCompoundTag($tag); // }
public function setRPGItem(Item $item, $name, $desc, $class) { $classData = self::$ITEM_CLASS[$class]; $item->setCustomName($classData["COLOR"] . ToAruPG::getTranslation($classData["TID"]) . $name); $item->getNamedTag()->desc = new String("desc", $desc); return $item; }