The Schematic class

class litemapy.Schematic(name: str = 'Unnamed', author: str = '', description: str = '', regions: dict[str, Region] | None = None, lm_version: int = 6, lm_subversion: int = 1, mc_version: int = 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 – The name of the schematic to write in the metadata

  • author – The name of the author to write in the metadata

  • description – The description to write in the metadata

  • regions – Regions to populate the schematic with

  • lm_version – The litematic version (you are unlikely to ever need to use this)

  • mc_version – The Minecraft data version (you are unlikely to ever need to use this)

static from_nbt(nbt: Compound) Schematic

Read a schematic from an NBT tag.

Parameters:

nbt – a schematic serialized as an NBT tag

Return type:

Schematic

Raises:

CorruptedSchematicError – if the schematic tag is malformed

static fromnbt(nbt: Compound) Schematic

Read a schematic from an NBT tag.

Parameters:

nbt – a schematic serialized as an NBT tag

Return type:

Schematic

Raises:

CorruptedSchematicError – if the schematic tag is malformed

property height: int

The height of this Schematic’s bounding box. See Coordinate systems. This property is read-only.

property length: int

The length of this Schematic’s bounding box. See Coordinate systems. This property is read-only.

static load(file_path) Schematic

Read a schematic from a file.

Parameters:

file_path – the filesystem path to the file to load

Return type:

Schematic

Raises:

CorruptedSchematicError – if the schematic file is malformed in any way

property regions: DiscriminatingDictionary

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(file_path: str, update_meta: bool = True, save_soft: bool = True, gzipped: bool = True, byteorder: str = 'big') None

Save this schematic to a file.

Parameters:
  • file_path – the filesystem path the schematic should be saved to

  • update_meta – whether to update the schematic’s metadata before saving (see update_metadata())

  • save_soft – whether to add an entry to the metadata indicating the schematic was created with Litemapy

  • gzipped – whether to compress the NBT content with gzip (this is the normal behavior)

  • byteorder – endianness of NBT numbers (either “little” or “big”, default is “big”)

Raises:

ValueError – if this schematic does not have any region

to_nbt(save_soft: bool = True) Compound

Write the schematic to an NBT tag.

Parameters:

save_soft – whether to add an entry to the metadata indicating the schematic was created with Litemapy

Return type:

Compound

Raises:

ValueError – if this schematic does not have any region

update_metadata() None

Update this schematic’s metadata (set the modified time to the current time).

updatemeta() None

Update this schematic’s metadata (set the modified time to the current time).

property width: int

The width of this Schematic’s bounding box. See Coordinate systems. This property is read-only.