Roofs#

Roofs over a rectangular footprint: gable, hip and flat.

Each roof covers the rectangle between two opposite corners, start and end, which are usually two opposite corners of the tops of the walls. The roof’s lowest course is at start.y + 1, directly on top of walls whose top blocks are at start.y. Only the x and z of end are used.

overhang widens the roof past the footprint on every side, so that the eaves stick out beyond the walls. The lowest course stays at start.y + 1, so a sloping roof with an overhang is that many blocks higher where it crosses the walls.

The sloping roofs, gable_roof() and hip_roof(), are built from stairs that rise one block for each block in from the eaves, so a roof over a footprint n blocks across is about n / 2 blocks high. Where the two slopes leave a gap one block wide at the top, the ridge block closes it: by default the slab that matches the stairs. flat_roof() is one layer of blocks, with an optional parapet.

Each function returns the bounding box of the blocks it placed, as a Volume.

mciwb.builders.gable_roof(start, end, stairs=Item.OAK_STAIRS, *, ridge=None, gable=None, axis=None, overhang=0)[source]#

Build a gable (pitched) roof: two slopes of stairs that meet at a ridge.

For a footprint 7 wide across the ridge, seen from the gable end (# is the gable, if one is given):

      ▄            <- ridge slab, y = start.y + 4
    ◢ # ◣
  ◢ # # # ◣
◢ # # # # # ◣      <- stairs, y = start.y + 1
W . . . . . W      <- walls, top at start.y

A footprint that is an even number of blocks across has no ridge blocks: the two slopes meet at the top.

Parameters:
  • start (Vec3) -- A corner of the footprint, usually the top of a corner of the walls. The roof starts at start.y + 1.

  • end (Vec3) -- The opposite corner of the footprint. Only x and z are used.

  • stairs (Item | str | BlockState) -- The stairs to build the slopes from.

  • ridge (Item | str | BlockState | None) -- The block along the ridge when the footprint is an odd number of blocks across. Defaults to the slab matching stairs, placed as a bottom slab. The gap under it, between the stairs of the course below, is filled with the same block as a double slab (or with ridge itself if it is not a slab).

  • gable (Item | str | BlockState | None) -- If given, fill the triangular gable ends under the roof with this block, above the footprint’s end walls. By default the ends are left open.

  • axis (str | None) -- "x" or "z", the direction that the ridge runs. Defaults to the longer side of the footprint ("x" for a square).

  • overhang (int) -- Extend the roof this many blocks past the footprint on every side, so that the eaves overhang the walls. The lowest course stays at start.y + 1, so the slopes cross the walls overhang blocks higher. The gables stay above the footprint’s end walls.

Returns:

The bounding box of the roof and its gables.

Raises:
  • ValueError -- If axis is not "x" or "z", if overhang is negative, or if ridge is not given and stairs is not a stairs block with a matching slab.

  • BuildError -- If the server rejects a command, for example for an unknown block or an unloaded chunk.

Return type:

Volume

Example:

from mciwb.imports import Item, Vec3, gable_roof

# over walls whose top blocks are at y = 74, with the ridge along z
roof = gable_roof(Vec3(0, 74, 0), Vec3(6, 74, 8), Item.SPRUCE_STAIRS,
                  gable=Item.SPRUCE_PLANKS, axis="z", overhang=1)
mciwb.builders.hip_roof(start, end, stairs=Item.OAK_STAIRS, *, ridge=None, overhang=0)[source]#

Build a hip roof: four slopes of stairs, one from each side.

Each course is a ring of stairs one block in and one block up from the course below, with outer corner stairs where two slopes meet. Where the slopes meet along a line one block wide (the ridge) the roof is finished with ridge blocks, on a line of full blocks (the ridge slab doubled) that fills the middle of the course below.

A footprint 7 by 5, seen from above, where each number is the course that the block is in (course 1 is at start.y + 1):

1 1 1 1 1 1 1
1 2 2 2 2 2 1
1 2 3 3 3 2 1      <- 3 is the ridge, on full blocks in course 2
1 2 2 2 2 2 1
1 1 1 1 1 1 1

A footprint whose shorter side is an even number of blocks has no ridge blocks: the slopes meet at the top. A square footprint gives a pyramid.

Parameters:
  • start (Vec3) -- A corner of the footprint, usually the top of a corner of the walls. The roof starts at start.y + 1.

  • end (Vec3) -- The opposite corner of the footprint. Only x and z are used.

  • stairs (Item | str | BlockState) -- The stairs to build the slopes from.

  • ridge (Item | str | BlockState | None) -- The block for a ridge one block wide. Defaults to the slab matching stairs, placed as a bottom slab. The middle of the course below it is filled with the same block as a double slab (or with ridge itself if it is not a slab).

  • overhang (int) -- Extend the roof this many blocks past the footprint on every side, so that the eaves overhang the walls. The lowest course stays at start.y + 1, so the slopes cross the walls overhang blocks higher.

Returns:

The bounding box of the roof.

Raises:
  • ValueError -- If overhang is negative, or if ridge is not given and stairs is not a stairs block with a matching slab.

  • BuildError -- If the server rejects a command, for example for an unknown block or an unloaded chunk.

Return type:

Volume

Example:

from mciwb.imports import Item, Vec3, hip_roof

roof = hip_roof(Vec3(0, 74, 0), Vec3(6, 74, 4), Item.BRICK_STAIRS,
                ridge=Item.STONE_BRICK_SLAB)
mciwb.builders.flat_roof(start, end, block=Item.SMOOTH_STONE, *, parapet=None, parapet_height=1, overhang=0)[source]#

Build a flat roof: one layer of blocks, with an optional parapet.

Parameters:
  • start (Vec3) -- A corner of the footprint, usually the top of a corner of the walls. The roof is at start.y + 1.

  • end (Vec3) -- The opposite corner of the footprint. Only x and z are used.

  • block (Item | str | BlockState) -- The roof block: a full block, or a slab for a thinner roof.

  • parapet (Item | str | BlockState | None) -- If given, build a low wall of this block around the edge of the roof, on top of it. Walls, fences and panes join up automatically.

  • parapet_height (int) -- The height of the parapet, in blocks. 0 or less gives no parapet.

  • overhang (int) -- Extend the roof, and its parapet, this many blocks past the footprint on every side.

Returns:

The bounding box of the roof and its parapet.

Raises:
  • ValueError -- If overhang is negative.

  • BuildError -- If the server rejects a command, for example for an unknown block or an unloaded chunk.

Return type:

Volume

Example:

from mciwb.imports import Item, Vec3, flat_roof

roof = flat_roof(Vec3(0, 74, 0), Vec3(6, 74, 8), Item.SMOOTH_STONE,
                 parapet=Item.STONE_BRICK_WALL)