Skip to main content

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.6 or higher is required.

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 block
  • entities: Everything that is not a block
  • blockentities: Extended metadata for blocks

Further Reading

For more information about the underlying objects, see nbtlib's excellent examples page.


License - MIT

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 nbtschematic, version 0.1.1.post1
Filename, size File type Python version Upload date Hashes
Filename, size nbtschematic-0.1.1.post1-py3-none-any.whl (6.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size nbtschematic-0.1.1.post1.tar.gz (5.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page