Skip to main content

A Minecraft MCA file reader/writer

Project description

mcapy

Documentation Status Tests

Python reader and writer for Minecraft region MCA (aka Anvil File Format) files.

It only works for the files from Minecraft v1.18 onward.

Installation

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

pip install mcapy

or directly from github

pip install git+https://github.com/wensheng/mcapy.git

Usage

Reading

from mca import Region

region = Region.from_file('r.0.0.mca')
chunk = region.get_chunk(0, 0)
block = chunk.get_block(0, 0, 0)

print(block)
print(block.id)
print(block.properties)

Making own regions

from mca import Block, EmptyRegion
from random import choice

# Create a new region with the `EmptyRegion` class at 0, 0 (in region coords)
region = EmptyRegion(0, 0)

# Create `Block` objects that are used to set blocks
stone = Block('minecraft', 'stone')
dirt = Block('dirt')  # you can omit 'minecraft' namespace

# 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.-1.-1.mca')

Note

This project is originally forked from anvil-parser, which was archived by its author.

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

mcapy-0.9.1.tar.gz (19.8 kB view hashes)

Uploaded Source

Built Distribution

mcapy-0.9.1-py3-none-any.whl (21.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page