Skip to content

Commit

Permalink
automatically set empty name for main tag when writing
Browse files Browse the repository at this point in the history
  • Loading branch information
KurtThiemann committed May 4, 2022
1 parent 83e59f4 commit 65eabcf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Tag/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 65eabcf

Please sign in to comment.