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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file mcapy-0.9.1.tar.gz.

File metadata

  • Download URL: mcapy-0.9.1.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for mcapy-0.9.1.tar.gz
Algorithm Hash digest
SHA256 c15dccfcc65c7e10b492422c3558b07a7d375cb82bf3e355714abb3706cf4f7c
MD5 710e3ea0a7ab71aa03301fa1aa74e789
BLAKE2b-256 c8f6c25d867bfcf21c4ebae848b87f33dda179acdae7c03c8ab75a4b06f0ce61

See more details on using hashes here.

File details

Details for the file mcapy-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: mcapy-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for mcapy-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7787e9cc75e6e673c51ea26f361411ba0bf472ace73e0d0c78425be900d3693d
MD5 af617017324bd05c90d18482a29eb32f
BLAKE2b-256 30b4bbea78755ee0dce0a54d4b06c9e18bffcb9e883f3c1507e055c6f5ac666c

See more details on using hashes here.

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