Learning to program with Minecraft

Gold Runner

To run the game, you will have to copy your file to the mcpi/api/python/ directory. Make sure Minecraft is running and then run your game with:

$ python treasureHunt.py

The first message (Move!) should appear on the screen, and the hunt is on!


The ability to program your Minecraft world using a simple Python API more than makes up for the lack of features in the Raspberry Pi version. Moreover, it's an entertaining way to help first-time programers, and kids especially, understand the use and usefulness of variables, loops, and functions, as well as to stimulate creativity and learn Python syntax.

Amazing projects are being created using the API, such as cannons [6], snake games [7], and more. As with Minecraft itself, the API is simple and straightforward, but by using the basic building blocks it provides, you can build really complex and interesting things.

Be aware, though, that Minecraft: Pi Edition is still in an early alpha stage and is prone to freezing and crashing, so I advise patience.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Using the Raspberry Pi as a Minecraft server

    Minecraft has millions of devoted fans worldwide, and players who organize a communal game with friends and acquaintances achieve an entirely new gaming experience. The Raspberry Pi is an excellent replacement for the Minecraft server.

  • Don't Use a Hammer

    When you first start building, you probably learn how to use one device and one programming language. Then comes the day you design a project that your toolset either can't solve or forces you to jump through too many hoops to get the outcome you desire. That's the day you start looking at new devices and languages to solve your problem. Having an arsenal of tools at your disposal makes solving problems easier.

  • Synchronizing with broadcasts

    This article draws inspiration from the popular Pokémon Go app to recreate a sprite hunting game in Scratch. The project explores synchronization and randomness as the player explores various backdrops in search of sprites.

  • Exploring the Kano Kit Pi pack and learning environment

    The Kano Kit learning platform puts the Pi in easy reach for even the youngest users.

  • Event Report: Pi and More 3

    From all over Germany, Raspberry Pi fans went to Trier in mid-June for "Pi and More 3." For a whole day, visitors of all ages enjoyed lectures and participated in hands-on workshops.