The BlockState class

Blocks in the schematic are represented by the BlockState class. It has a block identifier and block properties. E.g.

>>> block = BlockState("minecraft:oak_log", properties={"facing": "up"})
>>> block.blockid
"minecraft:oak_log"
>>> block["facing"]
"up"
class litemapy.BlockState(blockid, properties=None)

Represents an in-game block. BlockState are immutable.

A block state has a block ID and a dictionary of properties.

Parameters:
  • blockid (str) – the identifier of the block (e.g. minecraft:stone)

  • properties (dict[str, str]) – the properties of the block state (e.g. {“facing”: “north”})

property blockid

The block’s identifier.

Type:

str

static fromnbt(nbt)

Reads a BlockState from an nbt tag.

Return type:

BlockState

to_block_state_identifier(skip_empty=True)

Returns an identifier that represents the BlockState in the Sponge Schematic Format (version 2). Format: block_type[properties] Example: minecraft:oak_sign[rotation=0,waterlogged=false]

Parameters:

skip_empty (bool) – Whether empty brackets should be excluded if the BlockState has no properties.

Returns:

An identifier that represents the BlockState in a Sponge schematic.

Return type:

str