A Minecraft anvil file format parser
Project description
anvil-parser
Simple parser for the Minecraft anvil file format
Installation
This project is available on PyPI and can be installed with pip
pip install anvil-parser
or directly from github
pip install git+https://github.com/matcool/anvil-parser.git
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 and 1.15.2, should work fine for other versions.
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-parser-0.8.1.tar.gz
(12.6 kB
view hashes)
Built Distribution
Close
Hashes for anvil_parser-0.8.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db7669200d38364f7631efa1594f9c003d3527a9d1c123adab5831a69bfb53bd |
|
MD5 | de8534b8707b164a0544e9922380fe78 |
|
BLAKE2b-256 | 9e731ef2b75c39425f726a5a5e77ce2f1c9d47391dd2f4ce697cc28a4db4d749 |