public function writeTag(Tag $tag)
{
$this->putByte($tag->getType());
if ($tag instanceof NamedTAG) {
$this->putString($tag->getName());
}
$tag->write($this);
}
public function write(NBT $nbt) { foreach ($this as $tag) { if ($tag instanceof Tag and !$tag instanceof End) { $nbt->writeTag($tag); } } $nbt->writeTag(new End()); }