A parser for the Minecraft anvil file format, supports all Minecraft verions
Project description
anvil-parser2
A parser for the Minecraft anvil file format. This package was forked from matcool's anvil-parser in order to additionally support minecraft versions 1.18 and above.
Installation
pip install anvil-parser2
Usage
Reading
import anvil
region = anvil.Region.from_file('r.0.0.mca')
# You can also provide the region file name instead of the object
chunk = anvil.Chunk.from_region(region, 0, 0)
# If `section` is not provided, will get it from the y coords
# and assume it's global
block = chunk.get_block(0, 0, 0)
print(block) # <Block(minecraft:air)>
print(block.id) # air
print(block.properties) # {}
Making own regions
import anvil
from random import choice
# Create a new region with the `EmptyRegion` class at 0, 0 (in region coords)
region = anvil.EmptyRegion(0, 0)
# Create `Block` objects that are used to set blocks
stone = anvil.Block('minecraft', 'stone')
dirt = anvil.Block('minecraft', 'dirt')
# Make a 16x16x16 cube of either stone or dirt blocks
for y in range(16):
for z in range(16):
for x in range(16):
region.set_block(choice((stone, dirt)), x, y, z)
# Save to a file
region.save('r.0.0.mca')
Todo
things to do before 1.0.0
- Proper documentation
- Biomes
- CI
- More tests
- Tests for 20w17a+ BlockStates format
Note
Testing done in 1.14.4 - 1.19, should work fine for other versions. Writing chunks and regions is broken from 1.16 onwards
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
anvil-parser2-0.10.6.tar.gz
(29.0 kB
view details)
Built Distribution
File details
Details for the file anvil-parser2-0.10.6.tar.gz
.
File metadata
- Download URL: anvil-parser2-0.10.6.tar.gz
- Upload date:
- Size: 29.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbbc228d1a932251ee979ddcd1f77ab99eb2683fa57493eb37d309e10224d615 |
|
MD5 | 79564edca6eb53afe4e06633d7f4093c |
|
BLAKE2b-256 | 14201ee0d7015488e24c8919818efe89908ae14fd787c355779ba9cd71aa7bea |
File details
Details for the file anvil_parser2-0.10.6-py3-none-any.whl
.
File metadata
- Download URL: anvil_parser2-0.10.6-py3-none-any.whl
- Upload date:
- Size: 31.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72fc98c0b1f177fef4e60d3f42862c9c155d4609aa5a653d80335537dac99f4e |
|
MD5 | 006fe728916ae609cfa7c580e38b746e |
|
BLAKE2b-256 | 801523d22159c5699f5394ec1847adbf98c54aa9331ab2ce83748787d20ac5ef |