Open Matthias1590 opened 2 years ago
Hi @Matthias1590, Sorry to take so long getting back to you.
Essentially, NBTFile
subclasses TAG_Compound
, so unfortunately you can't just write any arbitrary compound tag at the root of a file.
A workaround would be to create an NBTFile and copy all the root elements into that NBTFile.
tag_compound = nbt.TAG_Compound(...)
nbt_file = nbt.NBTFile()
nbt_file.name = tag_compound.name
nbt_file.tags = tag_compound.tags
nbt_file.write_file("filename.nbt")
Hey there, I've been stuck at what should be a simple thing to do for a while now, I can't manage to write a compound tag to a file. Following the examples on PyPI didn't help much either as they don't write existing tags to files but rather create a new tag (using the nbt.NBTFile class) and write that. Am I missing something or is this just not supported? And if it's not supported, how should I go about doing this?