Hardware Reference
In-Depth Information
FIGURE.7-7
Minecraft skyline of Manhattan Island, New York
A
face
is a single flat surface that is part of a larger object; for example, one side
of a cube or the top of a drum.
You can create polygons (or faces) using the
drawFace()
function in
MinecraftDrawing.
The function expects a list of points (x, y, z) that, when con-
nected together in sequence, will create a complete polygon. Passing a
True
or
False
will determine whether the face is filled, and the final parameter is a what block the
face should be made from (see FigureĀ 7-8):
drawFace(points, filled, blockType, blockData)
Create a new program to experiment with the
drawFace()
function and create the
triangle shown in FigureĀ 7-8:
1.
First, open IDLE and create a new file. Save the file as
Polygon.py
in the
MyAdventures
folder.
2.
Import the
minecraft
,
block
and
minecraftstuff
modules by typing:
import mcpi.minecraft as minecraft
import mcpi.block as block
import mcpi.minecraftstuff as minecraftstuff