hasCompoundTag() public method

public hasCompoundTag ( ) : boolean
return boolean
Example #1
8
 /**
  * @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;
 }
Example #2
0
 public static function clearCustomColorToArmor(Item $item)
 {
     if (!$item->hasCompoundTag()) {
         return;
     }
     $tag = $item->getNamedTag();
     if (isset($tag->customColor)) {
         unset($tag->customColor);
     }
     $item->setCompoundTag($tag);
     //
 }