An extensive Minecraft worlds parser in the making.
Right now you can completely load a single or multi player world (read-only).
To load the entire world, call minecrafty.World()
.
from minecrafty import World
# Choose a single player world from your computer …
world_folder = r".\.minecraft\saves\New World"
# or a multi player world from your server.
world_folder = "./minecraft/world"
# Pass the folder to `minecrafty.World()`.
world = World(world_folder)
You may also call minecrafty.Level()
directly.
from minecrafty import Level
# Choose a single player world from your computer …
level_file = r".\.minecraft\saves\New World\level.dat"
# or a multi player world from your server.
level_file = "./minecraft/world/level.dat"
# Pass the folder to `minecrafty.Level()`.
level = Level(level_file)
# The NBT data is stored in the `nbt_tree` attribute of the level.
print(world.level.nbt_tree["Data"]["LevelName"])
New World
# Or if you loaded the `Level()` directly.
print(level.nbt_tree["Data"]["LevelName"])
New World