Builders#
Builders: functions that place whole parts of a structure in one call.
The builders are grouped by what they make:
roofs:
gable_roof(),hip_roof()andflat_roof()(mciwb.builders.roofs)arches and columns:
arch()andcolumn()(mciwb.builders.arches)stairways and roads along a path:
stairway()androad()(mciwb.builders.paths)foundations that follow the terrain:
foundation()(mciwb.builders.terrain)structures copied from the world or from Sponge schematic files:
Schematic(mciwb.builders.schematic, with the NBT file format inmciwb.builders.nbtfile)Placer, which all of them place their blocks with, for writing builders of your own (mciwb.builders.placer)BlockState, for blocks with block state properties such as the facing of stairs (mciwb.builders.blockstate)
They share these conventions:
They send their commands with the RCON client of the current thread (
get_client()), so they work as soon as anIwbhas connected.Positions are
Vec3. Coordinates follow Minecraft: y is up, north is -z and east is +x.Blocks are
Block: anItem, a block state string such as"oak_stairs[facing=east]", or aBlockState.Every function that places blocks returns the bounding box of those blocks as a
Volume, ready tograb, render or clear. (Schematic.pastereturns the box that the schematic covers.)A command that the server rejects, for example for an unknown block or a position in an unloaded chunk, raises
BuildError. Arguments that make no sense raiseValueError.
The other names work something out and place nothing, so they return their
answer and not a Volume:
ground_height() and
ground_heights() (which ask the server),
trace_path(), arch_profile(),
stair_shapes(), slab_of(),
full_block_of() and
facing_name(), and the methods of
Schematic that convert, transform, load and save.
Example:
from mciwb.imports import Item, Vec3, column, foundation, gable_roof
corner1, corner2 = Vec3(0, 70, 0), Vec3(8, 70, 6)
base = foundation(corner1, corner2, Item.COBBLESTONE)
for x, z in ((0, 0), (8, 0), (0, 6), (8, 6)):
column(Vec3(x, 71, z), 4, Item.STRIPPED_OAK_LOG)
roof = gable_roof(
corner1 + Vec3(0, 4, 0), corner2 + Vec3(0, 4, 0), Item.SPRUCE_STAIRS
)
Place blocks, recording the bounding box of every block placed. |
|
The server rejected a building command. |
Build a gable (pitched) roof: two slopes of stairs that meet at a ridge. |
|
Build a hip roof: four slopes of stairs, one from each side. |
|
Build a flat roof: one layer of blocks, with an optional parapet. |
Build an arch standing in a vertical wall plane. |
|
Work out the shape of an arch, without building it. |
|
Build a square column standing at base. |
Build a stairway along a path, climbing between the heights of its points. |
|
Build a road along a path, following the terrain. |
|
List the blocks along the middle of a path through some points. |
|
One block along the middle of a path. |
Build a foundation that follows the terrain, with a level top. |
|
Find the y of the top ground block of one column. |
|
Find the y of the top ground block of each of a set of columns. |
|
The Minecraft heightmaps: what counts as the ground. |
Block is the type of every argument that takes a
block.
A block id, its block state properties and its block entity data. |
|
Give the block state name of a direction. |
|
Work out the |
|
Find the slab made of the same material as a stairs block. |
|
Find the full block made of the same material as a stairs block. |
DATA_VERSION is the Minecraft data version written
in saved schematics.
A box of blocks with their block states. |