Hardware Reference
In-Depth Information
FIGURE.7-8 drawFace() used to create a triangle from three points
3. Connect to minecraft and create the MinecraftDrawing object:
mc = minecraft.Minecraft.create()
mcdrawing = minecraftstuff.MinecraftDrawing(mc)
4. Get the player's current position:
pos = mc.player.getTilePos()
5. Now you need to create a list to hold the points of the polygon. Start by typing:
points = []
6. Then append three points (x, y, z) to the points list, which, when joined together,
will create a triangle:
points.append(minecraft.Vec3(pos.x, pos.y, pos.z))
points.append(minecraft.Vec3(pos.x + 20, pos.y, pos.z))
points.append(minecraft.Vec3(pos.x + 10, pos.y + 20,
pos.z))
7. Use the MinecraftDrawing.drawFace function to create the triangle
polygon:
mcdrawing.drawFace(points, True, block.WOOL.id, 6)
8. Save the file and run the program to create the triangle polygon.
Search WWH ::




Custom Search