Demo Code#

Some example code that uses the MCIWB library.

demo#

demo.gate#

Define a castle gateway with portcullis

demo.gate.portcullis(position, close, width=4, height=6)[source]#

Open and close a portcullis

demo.gate.make_gate(position=None)[source]#

Create a castle gate with working portcullis

demo.shapes#

Functions to make some shapes in the world

demo.shapes.box(start: Vec3, size: int, item=Item.ACACIA_FENCE)[source]#

makes a cube of blocks with SW bottom corner at start

Factored for easy understanding

demo.shapes.pyramid(start: Vec3, size: int, item=Item.COBBLESTONE, **kwargs)[source]#

Build a pyramid with South West Corner at ‘start’

demo.pagoda#

demo.pagoda.build_pagoda(pos, width=4, floor_height=4, item: Item = Item.GOLD_BLOCK)[source]#

Create a pagoda out of blocks at the given position.

Each successive floor is narrower and each has a balcony at the top.

Parameters:
  • pos – position of the base of the pagoda

  • width – width of the base of the pagoda

  • floor_height – height of each floor

  • item – block to use for the base of the pagoda

demo.follow#

class demo.follow.SpookyPyramid(pyramid_centre, size=11, player=None)[source]#

Spooky Pyramid Class: draws a pyramid centred at pyramid_centre, made of carved pumpkins that always turn to face the player

demo.background#

Demonstrate the use of Monitor to set up a number of background threads to monitor the world and respond to player movement.