How do I read Minecraft mca files?
Question:
I’m trying to read a mca file in python3 but when I do issues occur, Mca files are not base64 and gzip because using a nbt library doesn’t work,
AND before you say it: There are issues with the anvil-parser library:
Traceback (most recent call last):
File "/Applications/nbt-editor/nbt-editor.py", line 141, in main
chunk = anvil.Chunk.from_region(region, 19, 22)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/anvil/chunk.py", line 382, in from_region
return cls(nbt_data)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/anvil/chunk.py", line 55, in __init__
self.data = nbt_data['Level']
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nbt/nbt.py", line 543, in __getitem__
raise KeyError("Tag %s does not exist" % key)
KeyError: 'Tag Level does not exist'
also the anvil-parser module spits this out, NOT the script
Answers:
The anvil-parser library you install with pip breaks when opening worlds from format 1.16 or higher, I got the answer from this comment by Damiaan:
Is the world MC version 1.18? It looks like the
anvilParser has some problems with this version: https://github.com/matcool/anvil-parser/issues/36.
The solution is to use a different fork of parser: https://github.com/0xTiger/anvil-parser
Edit: The normal version breaks on 1.16+
This comment helps a lot because I know a issue about anvil-parser and I know the correct version. So if you want to edit pre 1.16 worlds install anvil-parser with pip but if you want to edit 1.16 and above worlds then install anvil-parser from GitHub: https://github.com/0xTiger/anvil-parser
I’m trying to read a mca file in python3 but when I do issues occur, Mca files are not base64 and gzip because using a nbt library doesn’t work,
AND before you say it: There are issues with the anvil-parser library:
Traceback (most recent call last):
File "/Applications/nbt-editor/nbt-editor.py", line 141, in main
chunk = anvil.Chunk.from_region(region, 19, 22)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/anvil/chunk.py", line 382, in from_region
return cls(nbt_data)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/anvil/chunk.py", line 55, in __init__
self.data = nbt_data['Level']
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nbt/nbt.py", line 543, in __getitem__
raise KeyError("Tag %s does not exist" % key)
KeyError: 'Tag Level does not exist'
also the anvil-parser module spits this out, NOT the script
The anvil-parser library you install with pip breaks when opening worlds from format 1.16 or higher, I got the answer from this comment by Damiaan:
Is the world MC version 1.18? It looks like the
anvilParser has some problems with this version: https://github.com/matcool/anvil-parser/issues/36.The solution is to use a different fork of parser: https://github.com/0xTiger/anvil-parser
Edit: The normal version breaks on 1.16+
This comment helps a lot because I know a issue about anvil-parser and I know the correct version. So if you want to edit pre 1.16 worlds install anvil-parser with pip but if you want to edit 1.16 and above worlds then install anvil-parser from GitHub: https://github.com/0xTiger/anvil-parser