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", facing="up")
>>> block.blockid
"minecraft:oak_log"
>>> block["facing"]
"up"
- class litemapy.BlockState(block_id, **properties)
Represents an in-game block.
BlockStateare immutable.A block state has a block ID and a dictionary of properties.
- Parameters:
- static fromnbt(nbt)
Reads a
BlockStatefrom an nbt tag.- Return type:
- 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]
- with_blockid(block_id)
Returns a new
BlockStatewith the same properties as this one but a different block id.- Parameters:
block_id (str) – the block id for the new
BlockState
- with_properties(**properties)
Returns a new copy of this
BlockStatewith new values for the properties given in keyword arguments. Using None as a property value removes it.- Parameters:
properties (str | None) – the new properties as keyword arguments
- Returns:
A copy of this
BlockStatewith the given properties updated to new values- Return type: