Skip to main content

A Minecraft anvil file format parser

Project description


CodeFactor Documentation Status Build Status PyPI - Downloads

Simple parser for the Minecraft anvil file format


This project is available on PyPI and can be installed with pip

pip install anvil-parser

or directly from github

pip install git+



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( # air
print( # {}

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'r.0.0.mca')


things to do before 1.0.0

  • <input type="checkbox" checked="" disabled="" /> Proper documentation
  • <input type="checkbox" disabled="" /> Biomes
  • <input type="checkbox" checked="" disabled="" /> CI
  • <input type="checkbox" disabled="" /> More tests
    • <input type="checkbox" disabled="" /> Tests for 20w17a+ BlockStates format


Testing done in 1.14.4 and 1.15.2, should work fine for other versions.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for anvil-parser, version 0.9.0
Filename, size File type Python version Upload date Hashes
Filename, size anvil_parser-0.9.0-py3-none-any.whl (28.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size anvil-parser-0.9.0.tar.gz (25.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page