public function getCount() { $count = 0; foreach ($this as $tag) { if ($tag instanceof Tag) { ++$count; } } return $count; }
public function setNamedTag(CompoundTag $tag) { if ($tag->getCount() === 0) { return $this->clearNamedTag(); } $this->cachedNBT = $tag; $this->tags = self::writeCompoundTag($tag); return $this; }