The interactive shell#

mciwb shell opens an IPython prompt connected to the server, for trying things out a line at a time:

$ mciwb shell --player YOUR_NAME

It has what a script run by mciwb run has: world, and every name in mciwb.imports. Modules that you import are reloaded when you edit them. Tab completes names, so Item.OAK and Tab lists the oak blocks. For example:

In [1]: world.player.pos
Out[1]: Vec3(x=632, y=73, z=-1658)

In [2]: world.get_block(world.player.pos + Direction.DOWN)
Out[2]: <Item.SAND: 'minecraft:sand'>

In [3]: world.set_block(world.player.pos + Direction.NORTH * 2, Item.GLOWSTONE)

--player names a player who is in the game. It makes that player a server operator in creative mode, and they stay one afterwards. It gives world.player, and it gives the player a set of action signs. Placing one of them in the world, within 3 blocks in front of the player, runs some Python:

select

Place it twice, to mark two opposite corners of a box of blocks to copy. world.copier.start_pos is then the position of the last one, which is an easy way to find the coordinates of a block.

paste

Paste a copy of the box, with the last corner selected at the sign.

expand

Stretch the box to reach the sign.

clear

Set the box at the last place selected or pasted to air.

The interactive classes are frozen#

mciwb began as a way to learn Python by playing in a world, and the interactive classes come from then: Player, Signs (action signs), Switch (a lever or button that calls a function), Monitor (a function polled in a background thread), CopyPaste, Wall and WallMaker, and the examples in src/mciwb/demo. They still work and are tested, and the reference describes them, but they are no longer being developed. New work goes into scripts run with mciwb run (see Setup and first build).