mciwb.imports#
The names that a build script needs, in one place: import them from here.
A script, or a module that a script uses, imports what it needs with:
from mciwb.imports import Direction, Item, Vec3, get_world
A script run with mciwb run, and the mciwb shell session, already
have every one of these names, plus world: the Iwb that
is connected to the server. (A module that the script imports does not: it
uses the import above, and get_world() for world.)
The names come from two places:
mciwb itself:
Iwb,get_world(),get_client(),scan(),render(),BlockGrid, the interactive classes, and everything inmciwb.builders. Note thatrenderhere is the function, not themciwb.rendermodule. AlsoVec3,Direction,Volume,Anchor3andPlanes3dfrommciwb.geometry,Itemfrommciwb.item,polygon()frommciwb.shapes, andBlocks,Cuboid,grab(),load_items()andsave_items(), the frozen cuboid helpers ofmciwb.cuboids.mcipc:
FillModeandSetblockMode.
A few names are not here. Import Backup,
MinecraftServer, Palette,
PlayerNotInWorldError, set_client() and
new_thread() from mciwb, and
set_colour() from mciwb.palette.
The tables below list every name in mciwb.imports. Each name links to
where it is documented: in this reference, or in the documentation of
mcipc for the two names that
come from that library.
World#
The connection to a Minecraft world, for scripts and the shell. |
|
Return the current world object: the most recently created one. |
|
An RCON client for Minecraft Java Edition that copes with the server's other RCON clients. |
|
Get the RCON client of the current thread. |
See Connect and world.
Positions, blocks and shapes#
A position in the world, or an offset between two positions. |
|
The six unit vectors, as |
|
Minecraft Java Edition blocks and items. |
|
A box of blocks in the world, with its sides along the axes. |
|
Which point of a box a position refers to: one of its eight corners, the middle of its top or bottom face, or its centre. |
|
Build a hollow prism with a regular polygon as its cross section: a tower, or with fill_item a floor. |
See Positions and boxes, Items and Shapes. In short:
Vec3(x, y, z)is a position or an offset. Y is up. It supports+,-and* number.Directionholds the unit vectorsNORTH(0, 0, -1),SOUTH(0, 0, 1),EAST(1, 0, 0),WEST(-1, 0, 0),UPandDOWN.Direction.cardinals()lists the four compass directions.Itemhas a member for every block and item of the Minecraft release that mciwb supports, for exampleItem.STONE_BRICKS.Volume.from_corners(a, b)is a box of blocks, and itsfill(client, item)fills it.Anchor3says which corner or face of a box a position refers to, for exampleAnchor3.BOTTOM_NW.polygon(client, center, height, diameter, sides=4, direction=UP, item=..., mode=FillMode.KEEP)builds a hollow prism.
Cuboids (frozen)#
A cuboid of blocks placed in the world, which can then be moved and rotated. |
|
Read the blocks of a region of the world, one block at a time. |
|
Save a cuboid, a profile (a 2D list) or a row (a list) of |
|
Load the items that |
|
The three planes that |
and Cuboid, the type of a 3D array of
Item. Blocks(client, position, cuboid) places one
in the world, and grab(client, vol) reads one.
See Cuboids (frozen). Schematic is their successor.
Command modes#
These come from mcipc. FillMode is the
mode of polygon() and of
Placer.fill().
Available fill modes. |
|
Available modes to set blocks. |
Builders#
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. |
|
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. |
|
A box of blocks with their block states. |
and two that are not functions or classes: Block,
the type of every argument that takes a block, and
DATA_VERSION, the Minecraft data version written in
saved schematics.
See Builders.
Scan and render#
Read the blocks in a region of the world, by the fastest means available. |
|
Draw one or more views of a region side by side in one image. |
|
The blocks of a cuboid region of the world. |
See Scan and render.
Interactive (frozen)#
A player in the world, with their position and the way they are facing. |
|
A background thread that calls a list of functions again and again. |
|
A lever, button, pressure plate or tripwire hook that calls a function. |
|
Watch for command signs placed by one player, and call a function for each. |
|
Select a box of blocks in the world, then copy, fill or clear it. |
|
Draw walls between pairs of points in the world. |
|
Build walls interactively with command signs. |
|
Convert SNBT text, such as the reply to |
See Interactive (frozen).
Not in mciwb.imports#
A few names that scripts sometimes need are imported from elsewhere:
from
mciwb:Backup,MinecraftServer,Palette,set_client(),new_thread()andPlayerNotInWorldError;from
mciwb.palette:set_colour();from
mciwb.render:render_view()andauto_scale().