9781118946916-co0301.tif

BUILDING THINGS IN Minecraft is great fun. You can build almost anything you can dream up, limited only by the size of the Minecraft world and your imagination. You can build houses, castles, underground waterways, multi storey hotels with swimming pools, and even whole towns and cities! But it can take a lot of time and hard work to build complex objects with many different types of blocks, especially if there is a lot of repetition. What if you could automate some of your building tasks? Wouldn’t that look like magic to your friends?

A programming language like Python is ideal for automating complex tasks. In this adventure, you will learn some magic that allows you to automatically build large numbers of blocks inside the Minecraft world, and then loop through those instructions to build huge repeating structures, such as a whole street of houses (see Figure 3-1). Your friends will be amazed at your huge creations as they walk through rows and rows of houses and wonder how you built such complex structures! You will also learn how to read numbers from the keyboard when your program first runs, and this will enable you to write programs that your users can vary without changing your program code!

9781118946916-fg0301.tif

FIGURE 3-1 A house built from Minecraft blocks

Creating Blocks

Each type of block ...

Get Adventures in Minecraft now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.