levelz.builder

Classes

LevelBuilder

Represents a builder for creating LevelZ Levels.

Module Contents

class levelz.builder.LevelBuilder(dimension: levelz.coord.Dimension)

Represents a builder for creating LevelZ Levels.

_dimension: levelz.coord.Dimension
_blocks: list[levelz.block.LevelObject] = []
_headers: dict[str, object]
add_block(block: levelz.block.Block | str, coordinate: levelz.coord.Coordinate2D | levelz.coord.Coordinate3D | list[int | float])

Adds a Block to the LevelBuilder.

Parameters:
  • block – The Block to add.

  • coordinate – The Coordinate of the Block.

add_object(obj: levelz.block.LevelObject)

Adds a LevelObject to the LevelBuilder.

Parameters:

obj (LevelObject) – The LevelObject to add.

add_header(key: str, value: object)

Adds a header to the LevelBuilder.

Parameters:
  • key (str) – The key of the header.

  • value (object) – The value of the header.

build()

Builds the Level from the LevelBuilder.

property dimension
Returns the Dimension of the LevelBuilder.
property blocks
Returns an immutable copy of the blocks in the LevelBuilder.
property headers
Returns an immutable copy of the headers in the LevelBuilder.
static create_2d()

Creates a 2D LevelBuilder.

static create_3d()

Creates a 3D LevelBuilder.