The Schematic class
- class litemapy.Schematic(name='Unnamed', author='', description='', regions=None, lm_version=6, mc_version=2975)
Represents a schematic file in the Litematic format.
Schematic can be created by optionally providing metadata and regions, or leaving them blank or default.
- Parameters:
name (str) – The name of the schematic to write in the metadata
author (str) – The name of the author to write in the metadata
description (str) – The description to write in the metadata
regions (dict[str, Region]) – Regions to populate the schematic with
lm_version (int) – The litematic version (you are unlikely to ever need to use this)
mc_version (int) – The Minecraft data version (you are unlikely to ever need to use this)
- static fromnbt(nbt)
Read a schematic from an NBT tag.
- property height
The height of this Schematic’s bounding box. See Coordinate systems. This property is read-only.
- Type:
- property length
The length of this Schematic’s bounding box. See Coordinate systems. This property is read-only.
- Type:
- static load(fname)
Read a schematic from a file.
- Parameters:
fname – the filesystem path to the file to load
- Return type:
- Raises:
CorruptedSchematicError – if the schematic file is malformed in any way
- property regions
The regions in this schematic, as a dictionary. This is a read only property, and it is not possible to replace this dictionary. It can however be edited, as long as the suitable types are used. Using an incorrect type will raise a
DiscriminationError.
- save(fname, update_meta=True, save_soft=True, gzipped=True, byteorder='big')
Save this schematic to a file.
- Parameters:
fname (str) – the filesystem path the schematic should be saved to
update_meta (bool) – whether to update the schematic’s metadata before saving (see
updatemeta())save_soft (bool) – whether to add an entry to the metadata indicating the schematic was created with Litemapy
gzipped (bool) – whether to compress the NBT content with gzip (this is the normal behavior)
byteorder (str) – endianness of NBT numbers (either “little” or “big”, default is “big”)
- Raises:
ValueError – if this schematic does not have any region
- updatemeta()
Update this schematic’s metadata (set the modified time to the current time).
- property width
The width of this Schematic’s bounding box. See Coordinate systems. This property is read-only.
- Type: