O'Reilly logo

Adventures in Minecraft by Martin O'Hanlon, David Whale

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

9781118946916-co0701.tif

ONE OF THE great things about programming in Minecraft is that as well as looking at your creations on a 2D screen you can actually bring them to life in a virtual 3D world. You can walk around them, go inside them, make them bigger—even blow them up if you like! By using the ideas originally created to display 3D objects on a 2D screen, you can code 3D objects in Minecraft, turning the ordinary into the extraordinary.

In this adventure you will learn how to use the minecraftstuff module to create 2D lines and shapes which when combined with a little maths will allow you to program a clock so big you can stand on its hands as they go round (see Figure 7-1). Once you have mastered creating 2D shapes, you will then learn how to combine them together to create enormous 3D structures in seconds.

9781118946916-fg0701.tif

FIGURE 7-1 A massive Minecraft clock

The minecraftstuff Module

minecraftstuff is an extension module to the Minecraft API, which was written for Adventures in Minecraft, and contains all the code you need to draw shapes and control 3D objects. It has a set of functions called MinecraftDrawing, which allows you to create lines, circles, spheres and other shapes. Because this complicated code is in a separate module it makes it simpler for you to create the code, and it’s easier to understand ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required