Skip to main content

Minecraft Schematics - Minecraft Schematic Library

Minecraft Schematics is a Python library for working with Minecraft schematic files. It provides a simple and convenient way to read and process schematic files used in Minecraft.

The library is based on the Minecraft Schematic format version 2.

Features

  • Load Minecraft schematic files (.schematic) and read their contents.
  • Access schematic size and dimensions (width, height, length).
  • Get block data as a 3D numpy array representing the blocks in the schematic.
  • Access individual blocks' information, including type and properties.

Installation

To install Minecraft Schematics, you can use pip:

pip install minecraftschematics

Usage

Here's a quick guide on how to use the minecraftschematics library:

Schematic Class

The Schematic class is the main class of the library. It is used to load schematic files with the load method and access the schematic's data.

from minecraftschematics import Schematic

schematic = Schematic.load('path/to/your/schematic_file.schematic')

print(schematic.size)     # Output: (3, 4, 5)
print(schematic.width)    # Output: 3
print(schematic.height)   # Output: 4
print(schematic.length)   # Output: 5

# Get block data as a 3D numpy array
blocks = schematic.blocks
print(blocks.shape)      # Output: (3, 4, 5)
print(blocks[0, 0, 0])   # Output: Block(minecraft:redstone_wire[east=none,north=side,power=0,south=side,west=none])

# Get the positions of each block as their schematic id in a 1D numpy array
block_data = schematic.block_data
print(block_data)        # Output: [1, 2, 1, 1, 1, 3...]

# Get the offset of the schematic
offset = schematic.offset
print(offset)            # Output: (15, 3, 4)

# Or for the WorldEdit offset
we_offset = schematic.worldedit_offset
print(we_offset)         # Output: (15, 3, 4)

# Get additional metadata (if available)
metadata = schematic.metadata
print(metadata)          # Output: { 'Metadata_key_1': 'Metadata_value_1', ... }

Note: The schematic loading process will verify the schematic's version and raise an exception if it is not compatible with version 2. To force loading the schematic (not recommended), you can pass force=True to the load method.

Requirements

  • Python 3.10+
  • numpy
  • nbtlib

Contributing

If you have any suggestions, bug reports, or feature requests, please feel free to open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License.


This project is based on the Minecraft Schematic format version 2.

Author: Gabriel Werneck Paiva

Email: gwerneckpaiva@gmail.com

GitHub: Your GitHub Profile

Release files for minecraftschematics 0.1.2

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

Source distribution (sdist)

Source distribution for minecraftschematics 0.1.2
File Size Uploaded
minecraftschematics-0.1.2.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for minecraftschematics 0.1.2
File Interpreter ABI Platform
minecraftschematics-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / minecraftschematics-0.1.2.tar.gz

Download URL minecraftschematics-0.1.2.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
767c8c7fae4b4e6f05cb501588154ab16f228969386c04c3a8bd3e78e589bcd4
BLAKE2b-256 checksum
How to use checksums
4e7aa9746991f2d39eb12bee8f749dc5ab0d5ede0beda236449468d5255df389
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / minecraftschematics-0.1.2-py3-none-any.whl

Download URL minecraftschematics-0.1.2-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4cb373fff5acbaa59035f81e5a137ee44d5b95792f80641aaaa6375000437b2e
BLAKE2b-256 checksum
How to use checksums
3ad7eed96879fd1eff617d81e436cc607e54dcdc8e7d3805162f5803b9f26179
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

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