Minecraft Pi with Python

At the York Raspberry Jam, 8th June 2013, I gave a short workshop on programming minecraft on the Raspberry Pi using python. Here are the files that I used in the workshop along with my flashcards. Please try them out and use them as a basis for your own programs.

What is Minecraft Pi + Python?

Minecraft is a great “block creation” game that runs on PC’s, phones, and now even the Raspberry Pi. A “pocket edition” was written for phones, and this was ported to the Raspberry Pi. It is a cut down version, but there are some neat things you can still do with it.

On the Raspberry Pi, which comes pre-bundled with the python programming language, you can connect python programs to a running minecraft game and send it commands. These commands give you access to the game world and it’s player, and also allow you to create, destroy, and interact with blocks.

While this is not strictly “modding” minecraft, you can do some interesting things with it, such as adding new game behaviours, interacting with real world hardware, and linking to other programs.

I have just finished writing a small python program that reads a picture from a .BMP file and builds that image in blocks inside the minecraft world, as an example, which is attached below.

Martin O’Hanlon has some excellent 3D model building scripts that far out strip my work, but you might like my flashcards and my BMP builder as a way of getting you started, before you progress to larger projects.

Craig Richardson has written a detailed book containing lots of worked examples and exercises, that follows the same order as the codecademy python track.


If you follow the install instructions in my flashcards to the letter, they should work fine.

[1] Some people have had problems with the midori web browser crashing in the download. You can solve this by fetching the file at the command prompt like this:

wget https://s3.amazonaws.com/assets.minecraft.net/pi/minecraft-pi-0.1.1.tar.gz

[2] Some people have found that to get minecraft to run from the command line, they have to additonally mark the minecraft-pi file as “executable” like this:

chmod +x minecraft-pi

Update September 2014

You might be interested to know that I’ve teamed up with @martinohanlon, and we’re in the final stages of publishing a book all about programming with Minecraft – it’s due for release November 2014, in plenty of time for Christmas. You can pre-order from Amazon now.

All 9 projects work on the Raspberry Pi, the PC and the Mac. There are two chapters in the book that introduce and build electronic circuits that link up to Minecraft, and these projects also work on Raspberry Pi, PC, and Mac.

See link [8] below for more details. There’s a nice write-up about the book and the projects that it contains on the Wiley website (and also on Amazon), which really sets the context for the book and give you a good idea of the types of projects it contains.

Once the book is officially released, I’ll be refreshing my Minecraft resources on this blog to bring them up to date with the various advancements we’ve made by developing this book.


[1] minecraftPi-flashcards (PDF format)

[2] minecraftPi-flashcards (DOCX format)

[3] mcpi-BMPBuilder (ZIP of python script and some sample images)

[4] http://www.stuffaboutcode.com/p/minecraft.html Martin O’Hanlon’s excellent resources

[5] http://mcpipy.wordpress.com/ Pointers to lots of fun scripts to try

[6] https://github.com/brooksc/mcpipy A bit of an archive of mcpi scripts

[7] http://arghbox.wordpress.com/ Craig Richardson’s resources

[8] Martin O’Hanlon and David Whale, Adventures in Minecraft, Wiley, 2014.


This entry was posted in Python, Raspberry Pi. Bookmark the permalink.

Comments are closed.