Skip to main content

anvil-parser

Documentation Status Tests PyPI - Downloads

A parser for the Minecraft anvil file format. This package is based on matcool's anvil-parser and supp

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

Metadata

Release files for anvil-parser2 0.10.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anvil-parser2 0.10.4
File Size Uploaded
anvil-parser2-0.10.4.tar.gz 28.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for anvil-parser2 0.10.4
File Interpreter ABI Platform
anvil_parser2-0.10.4-py3-none-any.whl Python 3 none any Details

Total release size: 60.8 kB

Release files / anvil-parser2-0.10.4.tar.gz

Download URL anvil-parser2-0.10.4.tar.gz
Size 28.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1422bb0dac3823234f0cf66497de7a445623fbb8880548df2200c3791182e4f2
BLAKE2b-256 checksum
How to use checksums
bde48b6373c3b58698e26224737275809ed2530f80488d337d07451a6595a00f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / anvil_parser2-0.10.4-py3-none-any.whl

Download URL anvil_parser2-0.10.4-py3-none-any.whl
Size 31.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd7922242b84bfdf9913dec72776cbecdfe87543bfff369496e2354f8ba8c75b
BLAKE2b-256 checksum
How to use checksums
1def18df289cc4e72e859deb02d8b1ce5a2538b9d4a898819afe012a15c30d4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release history Release notifications | RSS feed

0.10.6

2 release files

0.10.5

2 release files

This release

0.10.4 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page