Tutorial: Getting Minecraft Pi Edition running with MCPIPY Scripts

This post will take you through getting Minecraft Pi Edition running on your Raspberry Pi.  If you have any problems, please leave a comment and we’ll work through the issues.

To get this running you will need:

  1. A Raspberry Pi board setup
  2. A working internet connection

By following these instructions you should have:

  1. Minecraft Pi Edition downloaded and running
  2. The ability to run python scripts

First, get Raspberry Pi running…

you’ll need Raspberry Pi setup running the Raspbian “Wheezy” distribution.  You can download this here and there are instructions on how to set it up.  I won’t go into detail here as I assume this is clear — as there are other good resources written on this like the official quick start guide.  If you get stuck here, leave a comment.

Second, Install Minecraft Pi Edition…

You need Minecraft Pi Edition installed.  To do this:

  1. Boot up the Raspberry Pi
  2. Login (default username is pi, password is raspberry)
  3. Start the Windowing system (type “startx” at the shell or comand line)
  4. Once it starts, start “LXTerminal” — this gives you a unix shell in a window.
  5. Create a directory to store the minecraft file.  I typed “mkdir minecraft” and “cd minecraft
  6. Download minecraft by typing “wget https://s3.amazonaws.com/assets.minecraft.net/pi/minecraft-pi-0.1.1.tar.gz“.  You should see output similar to:
pi@raspberrypi ~/minecraft $ wget https://s3.amazonaws.com/assets.minecraft.net/pi/minecraft-pi-0.1.1.tar.gz
--2013-02-22 09:10:51--  https://s3.amazonaws.com/assets.minecraft.net/pi/minecraft-pi-0.1.1.tar.gz
Resolving s3.amazonaws.com (s3.amazonaws.com)... 207.171.189.80
Connecting to s3.amazonaws.com (s3.amazonaws.com)|207.171.189.80|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1459472 (1.4M) [application/x-gzip]
Saving to: `minecraft-pi-0.1.1.tar.gz'

100%[======================================>] 1,459,472    100K/s   in 15s     

2013-02-22 09:11:21 (94.0 KB/s) - `minecraft-pi-0.1.1.tar.gz' saved [1459472/1459472]
  1. Next you have to unpack the files here — a “.tar.gz” file is like a “.zip” file or other archive.  To unpack it type “tar -zxvf minecraft-pi-0.1.1.tar.gz

You should see output similar to the below. What this represents is a list of all the files and directories that were extracted from the archive.

pi@raspberrypi ~/minecraft $ tar -zxvf minecraft-pi-0.1.1.tar.gz
mcpi/
mcpi/api/
mcpi/CONTROLS.txt
mcpi/data/
mcpi/HOW_TO_RUN.txt
mcpi/LICENSE.txt
mcpi/minecraft-pi
mcpi/VERSION.txt
mcpi/data/images/
mcpi/data/lang/
mcpi/data/lang/en_US.lang
mcpi/data/images/armor/
mcpi/data/images/art/
mcpi/data/images/environment/
mcpi/data/images/font/
mcpi/data/images/gui/
mcpi/data/images/item/
mcpi/data/images/mob/
mcpi/data/images/particles.png
mcpi/data/images/terrain.png
mcpi/data/images/terrain.pvr
mcpi/data/images/terrain.pvr4
mcpi/data/images/terrain.pvrtc
mcpi/data/images/terrain_4444.h
mcpi/data/images/terrain_5551.h
mcpi/data/images/terrain_565.h
mcpi/data/images/terrain_565_2.h
mcpi/data/images/mob/char.png
mcpi/data/images/mob/chicken.png
mcpi/data/images/mob/cow.png
mcpi/data/images/mob/creeper.png
mcpi/data/images/mob/pig.png
mcpi/data/images/mob/pigzombie.png
mcpi/data/images/mob/sheep.png
mcpi/data/images/mob/sheep_fur.png
mcpi/data/images/mob/skeleton.png
mcpi/data/images/mob/spider.png
mcpi/data/images/mob/zombie.png
mcpi/data/images/item/arrows.png
mcpi/data/images/item/camera.png
mcpi/data/images/item/sign.png
mcpi/data/images/gui/background.png
mcpi/data/images/gui/badge/
mcpi/data/images/gui/bg32.png
mcpi/data/images/gui/cursor.png
mcpi/data/images/gui/default_world.png
mcpi/data/images/gui/gui.png
mcpi/data/images/gui/gui2.png
mcpi/data/images/gui/gui_blocks.png
mcpi/data/images/gui/icons.png
mcpi/data/images/gui/itemframe.png
mcpi/data/images/gui/items.png
mcpi/data/images/gui/logo/
mcpi/data/images/gui/pi_title.png
mcpi/data/images/gui/spritesheet.png
mcpi/data/images/gui/title.png
mcpi/data/images/gui/touchgui.png
mcpi/data/images/gui/logo/raknet_high_72.png
mcpi/data/images/gui/logo/raknet_low_18.png
mcpi/data/images/gui/badge/minecon140.png
mcpi/data/images/font/default8.png
mcpi/data/images/environment/clouds.png
mcpi/data/images/art/kz.png
mcpi/data/images/armor/chain_1.png
mcpi/data/images/armor/chain_2.png
mcpi/data/images/armor/cloth_1.png
mcpi/data/images/armor/cloth_2.png
mcpi/data/images/armor/diamond_1.png
mcpi/data/images/armor/diamond_2.png
mcpi/data/images/armor/gold_1.png
mcpi/data/images/armor/gold_2.png
mcpi/data/images/armor/iron_1.png
mcpi/data/images/armor/iron_2.png
mcpi/api/java/
mcpi/api/python/
mcpi/api/spec/
mcpi/api/spec/mcpi_protocol_spec.txt
mcpi/api/python/mcpi/
mcpi/api/python/mcpi/__init__.py
mcpi/api/python/mcpi/block.py
mcpi/api/python/mcpi/connection.py
mcpi/api/python/mcpi/event.py
mcpi/api/python/mcpi/minecraft.py
mcpi/api/python/mcpi/util.py
mcpi/api/python/mcpi/vec3.py
mcpi/api/java/doc/
mcpi/api/java/HOW_TO_RUN_DEMOS.txt
mcpi/api/java/lib/
mcpi/api/java/McPi.jar
mcpi/api/java/McPiDemos.jar
mcpi/api/java/src-api/
mcpi/api/java/src-demos/
mcpi/api/java/src-demos/pi/
mcpi/api/java/src-demos/pi/demo/
mcpi/api/java/src-demos/pi/demo/ChristmasTreeDemo.java
mcpi/api/java/src-demos/pi/demo/DigitalClock.java
mcpi/api/java/src-demos/pi/demo/LoopDemo.java
mcpi/api/java/src-demos/pi/demo/LowLevelDemo.java
mcpi/api/java/src-demos/pi/demo/sokoban/
mcpi/api/java/src-demos/pi/demo/TextDemo.java
mcpi/api/java/src-demos/pi/demo/TurtleDemo.java
mcpi/api/java/src-demos/pi/demo/Usage.java
mcpi/api/java/src-demos/pi/demo/sokoban/Level.java
mcpi/api/java/src-demos/pi/demo/sokoban/Level_Data
mcpi/api/java/src-demos/pi/demo/sokoban/LevelTile.java
mcpi/api/java/src-demos/pi/demo/sokoban/Position.java
mcpi/api/java/src-demos/pi/demo/sokoban/Sokoban.java
mcpi/api/java/src-api/pi/
mcpi/api/java/src-api/pi/Block.java
mcpi/api/java/src-api/pi/Color.java
mcpi/api/java/src-api/pi/Connection.java
mcpi/api/java/src-api/pi/event/
mcpi/api/java/src-api/pi/EventFactory.java
mcpi/api/java/src-api/pi/Item.java
mcpi/api/java/src-api/pi/Log.java
mcpi/api/java/src-api/pi/Minecraft.java
mcpi/api/java/src-api/pi/package.html
mcpi/api/java/src-api/pi/tool/
mcpi/api/java/src-api/pi/Vec.java
mcpi/api/java/src-api/pi/VecFloat.java
mcpi/api/java/src-api/pi/tool/Csg.java
mcpi/api/java/src-api/pi/tool/package.html
mcpi/api/java/src-api/pi/tool/Text.java
mcpi/api/java/src-api/pi/tool/Tools.java
mcpi/api/java/src-api/pi/tool/Turtle.java
mcpi/api/java/src-api/pi/event/BlockAddedEvent.java
mcpi/api/java/src-api/pi/event/BlockEvent.java
mcpi/api/java/src-api/pi/event/BlockHitEvent.java
mcpi/api/java/src-api/pi/event/BlockRemovedEvent.java
mcpi/api/java/src-api/pi/event/ChatMessageEvent.java
mcpi/api/java/src-api/pi/event/EntityEvent.java
mcpi/api/java/src-api/pi/event/package.html
mcpi/api/java/src-api/pi/event/PlayerConnectEvent.java
mcpi/api/java/src-api/pi/event/PlayerEvent.java
mcpi/api/java/lib/McPi.jar
mcpi/api/java/doc/allclasses-frame.html
mcpi/api/java/doc/allclasses-noframe.html
mcpi/api/java/doc/constant-values.html
mcpi/api/java/doc/deprecated-list.html
mcpi/api/java/doc/index.html
mcpi/api/java/doc/overview-frame.html
mcpi/api/java/doc/overview-summary.html
mcpi/api/java/doc/package-list
mcpi/api/java/doc/pi/
mcpi/api/java/doc/resources/
mcpi/api/java/doc/stylesheet.css
mcpi/api/java/doc/resources/inherit.gif
mcpi/api/java/doc/pi/Block.html
mcpi/api/java/doc/pi/class-use/
mcpi/api/java/doc/pi/Color.html
mcpi/api/java/doc/pi/event/
mcpi/api/java/doc/pi/Item.html
mcpi/api/java/doc/pi/Minecraft.Camera.html
mcpi/api/java/doc/pi/Minecraft.Entities.html
mcpi/api/java/doc/pi/Minecraft.Events.html
mcpi/api/java/doc/pi/Minecraft.html
mcpi/api/java/doc/pi/Minecraft.Player.html
mcpi/api/java/doc/pi/package-frame.html
mcpi/api/java/doc/pi/package-summary.html
mcpi/api/java/doc/pi/package-use.html
mcpi/api/java/doc/pi/tool/
mcpi/api/java/doc/pi/Vec.html
mcpi/api/java/doc/pi/Vec.Unit.html
mcpi/api/java/doc/pi/VecFloat.html
mcpi/api/java/doc/pi/tool/class-use/
mcpi/api/java/doc/pi/tool/package-frame.html
mcpi/api/java/doc/pi/tool/package-summary.html
mcpi/api/java/doc/pi/tool/package-use.html
mcpi/api/java/doc/pi/tool/Text.html
mcpi/api/java/doc/pi/tool/Tools.html
mcpi/api/java/doc/pi/tool/Turtle.html
mcpi/api/java/doc/pi/tool/class-use/Text.html
mcpi/api/java/doc/pi/tool/class-use/Tools.html
mcpi/api/java/doc/pi/tool/class-use/Turtle.html
mcpi/api/java/doc/pi/event/BlockEvent.html
mcpi/api/java/doc/pi/event/BlockHitEvent.html
mcpi/api/java/doc/pi/event/class-use/
mcpi/api/java/doc/pi/event/package-frame.html
mcpi/api/java/doc/pi/event/package-summary.html
mcpi/api/java/doc/pi/event/package-use.html
mcpi/api/java/doc/pi/event/class-use/BlockEvent.html
mcpi/api/java/doc/pi/event/class-use/BlockHitEvent.html
mcpi/api/java/doc/pi/class-use/Block.html
mcpi/api/java/doc/pi/class-use/Color.html
mcpi/api/java/doc/pi/class-use/Item.html
mcpi/api/java/doc/pi/class-use/Minecraft.Camera.html
mcpi/api/java/doc/pi/class-use/Minecraft.Entities.html
mcpi/api/java/doc/pi/class-use/Minecraft.Events.html
mcpi/api/java/doc/pi/class-use/Minecraft.html
mcpi/api/java/doc/pi/class-use/Minecraft.Player.html
mcpi/api/java/doc/pi/class-use/Vec.html
mcpi/api/java/doc/pi/class-use/Vec.Unit.html
mcpi/api/java/doc/pi/class-use/VecFloat.html
  1. Almost done. Let’s do a few more commands and the output is shown below
  2. To see what files are in the “minecraft” folder type “ls -l“.  ls is the unix equivalent of the DOS “dir” command and it shows all the files in the current directory.  The “-l” option means provide the long version, that is show all the details (file sizes, etc)
  3. Change into the mcpi directory with “cd mcpi“.  Do a “ls -l” again to see what’s in there.
  4. Finally to run Minecraft, type “./minecraft-pi” and it should startup!  Below is the output of the above commands
pi@raspberrypi ~/minecraft $ ls -l
total 1432
drwxr-xr-x 4 pi pi    4096 Feb 11 05:52 mcpi
-rw-r--r-- 1 pi pi 1459472 Feb 11 06:05 minecraft-pi-0.1.1.tar.gz
pi@raspberrypi ~/minecraft $ cd mcpi
pi@raspberrypi ~/minecraft/mcpi $ ls -l
total 1204
drwxr-xr-x 5 pi pi    4096 Feb 22 09:17 api
-rw-r--r-- 1 pi pi     488 Dec 20 12:10 CONTROLS.txt
drwxr-xr-x 4 pi pi    4096 Feb 22 09:17 data
-rw-r--r-- 1 pi pi     208 Feb 11 05:07 HOW_TO_RUN.txt
-rw-r--r-- 1 pi pi     319 Feb 11 06:01 LICENSE.txt
-rwxr-xr-x 1 pi pi 1206760 Feb 11 05:49 minecraft-pi
-rw-r--r-- 1 pi pi      13 Feb 11 05:04 VERSION.txt
pi@raspberrypi ~/minecraft/mcpi $ ./minecraft-pi

Third, get the mcpipy scripts

Next let’s get a copy of all the mcpipy scripts from this blog on your raspberry pi..  To do this, open a new LX Termainl because the old one is running Minecraft and run the following commands:

  1. If you haven’t installed git, you can install it by selecting “sudo apt-get install git” and select Y for yes.
  2. Create a new directory, I’d suggest mcpipy.  Type  “cd ~“.  This changes back to your home directory.  The “~” part here is special to the unix shell, it means the home directory of the user – which in this case is /home/pi
  3. Next download the mcpipy scripts by running “git clone https://github.com/brooksc/mcpipy.git
  4. Change to the mcpipy directory with “cd mcpipy
  5. Check to see what’s in the directory with “ls -l
  6. Choose a script to run.  I like the rainbow script as it’s quick and it’s obvious that it’s been run.  In this case type “python zhuowei_rainbow.py
  7. Repeat step #5 with whatever script you want to run — you should be all set!
pi@raspberrypi ~ $ git clone https://github.com/brooksc/mcpipy.git
Cloning into 'mcpipy'...
remote: Counting objects: 75, done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 75 (delta 28), reused 72 (delta 25)
Unpacking objects: 100% (75/75), done.
pi@raspberrypi ~ $ cd mcpipy
pi@raspberrypi ~/mcpipy $ ls -l
total 120
-rw-r--r-- 1 pi pi   757 Feb 22 09:34 brooksc_teleport_pad.py
-rw-r--r-- 1 pi pi  4529 Feb 22 09:34 brooksc_tntsnake.py
-rw-r--r-- 1 pi pi  5286 Feb 22 09:34 burnaron_bunkermatic2.py
-rw-r--r-- 1 pi pi  3762 Feb 22 09:34 burnaron_bunkermatic.py
-rw-r--r-- 1 pi pi  4641 Feb 22 09:34 davef21370_maze.py
-rw-r--r-- 1 pi pi 10397 Feb 22 09:34 daviewales_minesweeper.py
drwxr-xr-x 2 pi pi  4096 Feb 22 09:34 mcpi
-rw-r--r-- 1 pi pi   592 Feb 22 09:34 nt7s_sphere.py
-rw-r--r-- 1 pi pi  2720 Feb 22 09:34 obsidz_teleport.py
-rw-r--r-- 1 pi pi  1008 Feb 22 09:34 README.md
-rw-r--r-- 1 pi pi  4741 Feb 22 09:34 sleepyoz_analogclock.py
-rw-r--r-- 1 pi pi  5316 Feb 22 09:34 sleepyoz_digitalclock2.py
-rw-r--r-- 1 pi pi  6382 Feb 22 09:34 sleepyoz_digitalclock3.py
-rw-r--r-- 1 pi pi  3888 Feb 22 09:34 sleepyoz_digitalclock.py
-rwxr-xr-x 1 pi pi   489 Feb 22 09:34 snowbound_flatmap.py
-rw-r--r-- 1 pi pi  2581 Feb 22 09:34 stuffaboutcode_basics.py
-rw-r--r-- 1 pi pi  2381 Feb 22 09:34 stuffaboutcode_bridge.py
-rw-r--r-- 1 pi pi  6453 Feb 22 09:34 stuffaboutcode_clock.py
-rw-r--r-- 1 pi pi  3130 Feb 22 09:34 stuffaboutcode_hideandseek.py
-rw-r--r-- 1 pi pi   461 Feb 22 09:34 zhuowei_ejectcd.py
-rw-r--r-- 1 pi pi   606 Feb 22 09:34 zhuowei_rainbow.py
pi@raspberrypi ~/mcpipy $ python zhuowei_rainbow.py

Finally, get the mcpipy updates

When you see a new script posted on the blog, to get it on your raspberry pi all you need to do is run the following command to get the latest updates:

  1. Run “git fetch origin” to download the latest updates
  2. Run “git merge origin/master” to update the files in your current directory with them.
i@raspberrypi ~/mcpipy $ git fetch origin
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 2 (delta 1), reused 2 (delta 1)
Unpacking objects: 100% (2/2), done.
From https://github.com/brooksc/mcpipy
   02423a0..db2767d  master     -> origin/master
pi@raspberrypi ~/mcpipy $ git merge origin/master
Updating 338f155..db2767d
Fast-forward
 .gitignore                                          |    2 ++
 brooksc_teleport__pad.py => brooksc_teleport_pad.py |    0
 mcpi/block.py                                       |    5 +++
 mcpi/connection.py                                  |    8 ++---
 mcpi/minecraft.py                                   |   42 +++++++++++++---------
 mcpi/util.py                                        |    2 +-
 mcpi/vec3.py                                        |    7 ----
 stuffaboutcode_clock.py                             |  169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 207 insertions(+), 28 deletions(-)
 rename brooksc_teleport__pad.py => brooksc_teleport_pad.py (100%)
 create mode 100644 stuffaboutcode_clock.py

That’s it, hopefully everything worked out — and if not, please leave a comment and we’ll figure out together what went wrong!

22 thoughts on “Tutorial: Getting Minecraft Pi Edition running with MCPIPY Scripts

  1. Hi, thanks for the tutorial, I still having problems.
    1 mine craft pi is installed and working
    2 I have installed github and set up my account
    3 I have downloaded all the scripts
    4 when I type the script name in terminal nothing happens. Am I supposed to have min craft pi running in the background?
    Sorry but am new to all of this

    • Yes you need to have minecraft running to run any of these scripts. You also need to start a game and load a world.

      This is because these scripts “talk” to Minecraft — and if it’s not running with a world loaded, it can’t run.

      I’d recommend as a first script zhuowei_rainbow.py. This is a simple script that creates a large rainbow in the world so it’s obvious if it worked.

      To run this, type into LX Terminal:

      python zhuowei_rainbow.py

      Or the following should work:

      ./zhuowei_rainbow.py

      Please let me know whether that worked for you or not, thanks!

  2. When i try to do “git fetch origin”, i get this error:
    “fatal: Not a git repository (or any of the parent directories): .git
    What do i do?
    And BTW, when i load a script, nothing happens… A world is loaded, on teh pause menu. Am i supposed to place the mcpipy folder somewhere special, or just in the home folder, as i have it now?!? (Sorry for my bad english, from norway.)

    • Did you previously download the git files?

      Try this:

      cd ~
      git clone https://github.com/brooksc/mcpipy.git
      cd mcpipy

      This should download all the scripts.

      To run them, you should have minecraft running and start a game.

      Let me know if this works!

  3. Thanks very much for thus tutorial, I was really confused about the whole idea of running scripts on my ‘pi but now it is much clearer.

  4. Thank you so much!
    This appears to be the only tutorial like this on the web.
    I bet a lot of people couldnt figure it out like me

  5. If we install minecraft into the directory we created will that affect further updates or using other tutorials to do things in minecraft pi?

    • I’d recommend creating two top level directories as described in the blog posting.

      ~/mcpi – is the directory where you unpack minecraft according to the blog post.
      ~/mcpipy — where you store the scripts you download from git

      The ~ here refers to the unix home directory — for the pi account this is /home/pi

      If you keep the two in separate directories there shouldn’t be an issue. You can freely delete one or both and re-download as needed.

      If that didn’t answer your question, please leave a comment!

  6. Hi,
    I am very new at this.
    I got stuck at the start. I used mkdir and cd to create the directory “minecraft” and go to it. But when I typed the wget command from your tutorial above, I got this error: “unable to resolve host address ‘s3.amazonaws.com’ ”

    As it happens, I already have minecraft.pi (note the filename has a “period”, not a “dash”) on my rpi desktop because before I found your tutorial I had downloaded the minecraft “folder” to the mac and transferred it to the rpi desktop from a memory stick via the rpi USB port, and then further dragged the file minecraft.pi onto the rpi desktop.

    So, I again used cd to get back to the rpi Desktop, and then ls to show that minecraft.pi was there, and then I tried the command farther down in your tutorial: ./minecraft-pi, (using the “dash”) and I got this error: “Permission denied”. I then tried ./minecraft.pi, (using the “period”) and I got this error: “No such file or directory”

    Can you help me? Related to this, the wget command is pretty long, and isn’t there a way to “repeat” previous commands at the command line so they don’t have to be retyped character by character? Thanks very much.

    • To start with, it sounds like you have a networking problem on your raspberry pi.

      Try this —

      can you “ping 8.8.8.8”? you should get a response back like:

      > ping 8.8.8.8
      PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
      64 bytes from 8.8.8.8: icmp_req=1 ttl=54 time=112 ms

      hit Control-C to abort it.

      unfortunately you can’t ping the amazonaws.com address – but then try again

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

      this should download minecraft to the current directory

      to access previous commands, use up/down arrows.

      hope that helps 🙂

  7. Do you think it would be possible to make scripts that add animals into the game, such as horses and other animals on the game? I am sort of new to my pi and this whole “scripts” thing, do if you can’t, that’s ok. I’m just wondering 😀

Leave a comment