Example #1
0
 /**
  * @param Item $item
  * @param int  $slot
  * @return Compound
  */
 public static function putItemHelper(Item $item, $slot = null)
 {
     $tag = new Compound(null, ["id" => new Short("id", $item->getId()), "Count" => new Byte("Count", $item->getCount()), "Damage" => new Short("Damage", $item->getDamage())]);
     if ($slot !== null) {
         $tag->Slot = new Byte("Slot", (int) $slot);
     }
     if ($item->hasCompoundTag()) {
         $tag->tag = clone $item->getNamedTag();
         $tag->tag->setName("tag");
     }
     return $tag;
 }