Skip to content

Commit 65eabcf

Browse files
committed
automatically set empty name for main tag when writing
1 parent 83e59f4 commit 65eabcf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Tag/Tag.php

+3
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ public function write(Writer $writer): Tag
140140
if(!($this instanceof CompoundTag) && !(in_array($writer->getFormat(), [NbtFormat::BEDROCK_EDITION_NETWORK, NbtFormat::BEDROCK_EDITION]) && $this instanceof ListTag)){
141141
throw new Exception("NBT files must start with a CompoundTag (or ListTag for Minecraft Bedrock Edition)");
142142
}
143+
if($this->getName() === null) {
144+
$this->setName("");
145+
}
143146
$writer->write($this->serialize($writer->getSerializer()));
144147
return $this;
145148
}

0 commit comments

Comments
 (0)