Parser and editor for Luanti worlds
Project description
mtanvil
A Python library for parsing and editing Luanti worlds.
The name comes from Luanti’s former name (‘MT’ for Minetest) and the Minecraft world parsing library ‘anvil’
This is extremely under development so please don't use this for any major projects right now. Future updates will have breaking changes.
However, testing is welcome so please do open an issue if you find problems with it.
mtanvil fully supports MapBlock format version 29 (latest). Other versions may not be fully supported but should receive full support in the future.
It is recommended that you familiarize yourself with the Map File Format and MapBlock Serialization Format so that you fully understand what data mtanvil provides.
Usage
Currently mtanvil is not available as a package (yet), so you must download mtanvil.py and put it in the same directory as the file that will import it.
First of all, import mtanvil with
import mtanvil as anvil
You can then load a world file:
world = anvil.World.from_file('/path/to/map.sqlite')
World functions
-
world.list_mapblocks(): Returns a list of all MapBlocks present in the world file -
world.get_mapblock(pos): Returns a MapBlock.posshould be a tuple of the XYZ coords, eg (5, -4, 18) -
world.set_mapblock(pos, data): Writes a MapBlock to the world.datashould be serialized, see MapBlock's functions
NOTE: you should ensure that the world is currently not in use by Luanti before writing to it
-
world.get_all_mapblocks(): Returns all MapBlocks present in the world file. Each list item is a tuple: (X, Y, Z, MapBlock) -
world.close(): Closes the database connection. It is recommended to run this once you're finished with the World
MapBlock functions
-
mapblock.data: Dictionary of the parsed data -
mapblock.parse(data): Returns a dictionary of the parsed data.datamust be a raw binary blob from the database -
mapblock.set_node(pos, param0, param1 = 0, param2 = 0): Sets the node at the specified co-ordinates.param0is the node name, egdefault:goldblock -
mapblock.serialize(data = None, compressed = True): Turns dictionary of parsed data back into binary. IfdataisNone,mapblock.datawill be serialized instead.compressedis required for Luanti MapBlock format version 29+
Utility functions
-
pos_get_mapblock(pos): Returns a tuplet with the position of the MapBlock that has the world co-ordinates provided -
pos_get_node(pos): Returns a tuplet with the position within the relevant MapBlock (see function above) of the world co-ordinates provided
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mtanvil-0.1.0.tar.gz.
File metadata
- Download URL: mtanvil-0.1.0.tar.gz
- Upload date:
- Size: 19.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c904b8cb43b65b337aa28ead0a43a9e7e63c05dec9551a9eb9dc2fd84639178
|
|
| MD5 |
1dbe7c665d1bfa91edc51f182173115e
|
|
| BLAKE2b-256 |
2f7a672f06f7978f10ed6f789cbd32352671e1d14d7c0cbff9de9b1bbb7bee29
|
Provenance
The following attestation bundles were made for mtanvil-0.1.0.tar.gz:
Publisher:
python-publish.yml on fancyfinn9/mtanvil
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mtanvil-0.1.0.tar.gz -
Subject digest:
1c904b8cb43b65b337aa28ead0a43a9e7e63c05dec9551a9eb9dc2fd84639178 - Sigstore transparency entry: 774611675
- Sigstore integration time:
-
Permalink:
fancyfinn9/mtanvil@2599cab6c11c0702710609416fcfda3548d742f7 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/fancyfinn9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@2599cab6c11c0702710609416fcfda3548d742f7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file mtanvil-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mtanvil-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca57568474aab57e43b4ec43032a9bda04555d7117993f4ce29470f9973e709e
|
|
| MD5 |
15b567a5db3cbbfee0fd104016365ad6
|
|
| BLAKE2b-256 |
4aecf213d490ed6f339ae7bea5511de05267cf662211c2353b02a844361b2dda
|
Provenance
The following attestation bundles were made for mtanvil-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on fancyfinn9/mtanvil
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mtanvil-0.1.0-py3-none-any.whl -
Subject digest:
ca57568474aab57e43b4ec43032a9bda04555d7117993f4ce29470f9973e709e - Sigstore transparency entry: 774611679
- Sigstore integration time:
-
Permalink:
fancyfinn9/mtanvil@2599cab6c11c0702710609416fcfda3548d742f7 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/fancyfinn9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@2599cab6c11c0702710609416fcfda3548d742f7 -
Trigger Event:
release
-
Statement type: