WHEN YOU PLAY Minecraft, you are playing a game that other people have designed for you. The Minecraft world is fun, but it’s even more fun if you can make it do the things that you want it to do. When writing Minecraft programs in Python, you now have a complete programming environment at your fingertips, and you can invent and program anything you can possibly imagine. This adventure introduces you to some of the fun things you can create using Minecraft and the programming language Python.

A really fun thing to do when programming Minecraft is to create a game within a game. Minecraft is the “world”, and your program makes this world behave in new ways. You will find that most Minecraft programs have three things that make them fun and exciting: sensing something about the world, such as the player position; calculating something new, such as a score; and behaving in some way, such as moving your player to a new location.

This adventure shows you how to sense your player’s position and make different things happen in the game as your player moves. In the welcome home game you build a magic doormat that greets you when you walk on it. We introduce a technique called geo-fencing using a real Minecraft fence, and your game will challenge you and your friends to compete to collect objects in the fastest time possible. Finally you learn how to move your player by making your game ...

Get Adventures in Minecraft, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.