A simple schematic file reader for nbtlib
Project description
nbtschematic
A simple nbtlib Schema for reading or writing Schematic files for MCEdit and other world editors.
Installation
Python 3.8 or higher is required. You should probably create a new virtual environment before you install. Once you have activated your virtual environment, run
pip3 install nbtschematic
Examples
To load an existing MCEdit or other schematic file from disk, run:
from nbtschematic import SchematicFile
sf = SchematicFile.load('tests/test_schematic/simple.schematic')
print("The block at Y=%d, Z=%d, X=%d has block ID %d" %
(2, 3, 0, sf.blocks[2, 3, 0]))
To generate a schematic file in python, run:
from nbtschematic import SchematicFile
sf = SchematicFile(shape=(10, 8, 4))
assert sf.blocks.shape == (10, 8, 4)
sf.blocks[2, 3, 0] = 42
sf.save('example.schematic')
The size of the schematic should be defined at construction time. Resizing it will clear the blocks and block data.
Other fields of interest include:
data
: Block data for each and every blockentities
: Everything that is not a blockblockentities
: Extended metadata for blocks
Further Reading
For more information about the underlying objects, see nbtlib
's excellent
examples
page.
License - MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file nbtschematic-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: nbtschematic-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37b16287469395ce0c2be71c5633dc7498aa8d8dca6ad6226114c05522eba55b |
|
MD5 | 9ee8133e5b2a4351ab2b6c86e2bdb808 |
|
BLAKE2b-256 | 79457cf66ff1cb66851dd656f6b9dc159b6ec625f6a597c7c48d3257cb67a714 |