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.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 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.

Source Distribution

nbtschematic-0.2.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

nbtschematic-0.2.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file nbtschematic-0.2.0.tar.gz.

File metadata

  • Download URL: nbtschematic-0.2.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.0.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for nbtschematic-0.2.0.tar.gz
Algorithm Hash digest
SHA256 219e334a605ea02b041de075145680a7c8187ccfea9873cad3ba6c29bfc09529
MD5 19fc67c9f410ea462da8112b028a0e33
BLAKE2b-256 f94a4973f9089281a5863753b9dfbee6dd5d6536a41f62eb0a8fd2e674ea1bed

See more details on using hashes here.

File details

Details for the file nbtschematic-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: nbtschematic-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.0.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for nbtschematic-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52211fb630a8e3f5636d8fe9b9e861346ac394fbe22cc6a18df8b41dfe5eb66e
MD5 8e7e6ff1fa45c2900ce793351d29b569
BLAKE2b-256 b37a2015a6e6518a3dae87be5eb8c08926bc68b8da8a341a35027bb7630dc7e8

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