diff --git a/src/Tag/Tag.php b/src/Tag/Tag.php index 71c611d..d39e02a 100644 --- a/src/Tag/Tag.php +++ b/src/Tag/Tag.php @@ -140,6 +140,9 @@ public function write(Writer $writer): Tag if(!($this instanceof CompoundTag) && !(in_array($writer->getFormat(), [NbtFormat::BEDROCK_EDITION_NETWORK, NbtFormat::BEDROCK_EDITION]) && $this instanceof ListTag)){ throw new Exception("NBT files must start with a CompoundTag (or ListTag for Minecraft Bedrock Edition)"); } + if($this->getName() === null) { + $this->setName(""); + } $writer->write($this->serialize($writer->getSerializer())); return $this; }