How To Setup Minecraft On The Raspberry Pi

Until recently I had never played Minecraft but it’s popularity meant it was something I felt I had to try. I installed the free pocket edition on my Nexus 7 to try it out and as a result decided to give it a go on the Pi.

MinecraftUsing the Pi to run Minecraft opens up the possibility to interact with the 3D world using Python. This is something that particularly interested me. You can build structures using the normal interface but on the Pi you’ve got the chance to control that world using scripts to create and edit blocks.

The Pi Edition is similar to earlier versions of the Pocket Edition and only offers “Creative” mode. Therefore it’s not as advanced or fancy as the versions you may be used to playing on other platforms.

So lets get started!

Minecraft Pi Edition Header

Installation

I suggest starting off with a fresh installation of Raspbian on your SD card. The latest image can be downloaded from http://www.raspberrypi.org/downloads

Boot the Pi, login and then type the following command :

startx

This will run the graphical interface. Click the LXTerminal icon to open a terminal window. Use the following command to download the Minecraft package from the official site :

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

Then use the following to unzip the contents :

tar -zxvf minecraft-pi-0.1.1.tar.gz

This should have created a directory and extracted some files into it. Let’s open that directory :

cd mcpi

Then finally you can run the application using :

./minecraft-pi

The Minecraft window should open and look something like this :

Minecraft Screenshot 01Click “Start Game” to dive in and generate a new world to explore.

Minecraft Screenshot 02Minecraft runs at a fixed resolution so your screen may look different depending on your monitor settings. You can maximise the window and run full screen but this may affect your mouse pointer. Be prepared to start using the keyboard!

Minecraft Screenshot 03

Add Desktop Icon

It’s a bit of a pain to open a command prompt every time you want to play but it is easy to create a short-cut icon on the desktop.

Minecraft Pi Edition IconFirst, save this image to your computer as “minecraft.png” and copy it to your Pi and into your mcpi folder.

Right-click on your LXDE desktop and select “Create New” followed by “Blank File”

Name the file “minecraft.desktop”. Click OK and the short-cut file should appear on the desktop.

Right-click on this new .desktop file and select “Leafpad”. The file will open in the “Leafpad” text editor.

Copy the following code into “Leafpad” :

[Desktop Entry]
Name=Minecraft Pi Edition
Comment=Launch Minecraft Pi Edition!
Exec=sh -c 'cd ~/mcpi && lxterminal -l -t Minecraft -e ./minecraft-pi'
Icon=/home/pi/mcpi/minecraft.png
Terminal=false
Type=Application
Categories=Application;Games;
StartupNotify=true

Using the “File” menu save the file and exit “Leafpad”.

The short-cut should now have a nice icon and a title of “Minecraft Pi Edition”.

Minecraft Desktop Icon Example

Double-clicking the icon will launch Minecraft.

Using Minecraft

This isn’t the place to give an extensive guide to using Minecraft but I thought I would present some basics to get you moving around the environment.

ESC  Pause/Menu
W    Move forward
A    Move left
S    Move backwards
D    Move right
E    Show inventory of blocks
1-8  Select items in the quick-bar

Left mouse  Destroy blocks
Right mouse Place blocks

Space  Jump (ascend in fly-mode)
Shift  Sneak (descend in fly-mode)

The mouse can be used to change your point-of-view. The scroll wheel can be used to scroll through the items, the left mouse button being used to select a block. When viewing the inventory you can use the WASD keys to move the selection using the Enter key to select a block.

Double-tapping the Space bar will activate and deactivate fly-mode.

You can exit Minecraft by clicking the [x] in the top right hand corner of the game window.

MinecraftPython API

Now you’ve got Minecraft running take a look at my tutorial on configuring the Python API. This allows you to control the Minecraft world using Python scripts.

It’s a great way to build structures and learn Python at the same time.

This entry was posted in Minecraft, Python, Tutorials & Help and tagged , , . Bookmark the permalink.



18 Responses to How To Setup Minecraft On The Raspberry Pi

  1. Tim Smith says:

    It was this version that got my daughter hooked on Minecraft (I have to take full responsibility!)
    I was a little disappointed with the limitations of this version compared to the full versions on PC and iPad until I discovered that you can access Minecraft with a Python API.
    I’m a long way from being an expert, what I have learnt has mostly come from
    Stuff About Code
    My project is to combine Minecraft with the GPIO to shine different LEDs depending on what I’m standing on. Stuff About Code has some very cool examples including clocks that update in realtime

    • Matt says:

      I think lots of people might be disappointed as the official information doesn’t quite make it clear this is a basic version. I’ve not played the full-featured versions so I haven’t been spoilt with new features. The Python API is what interested me. The “Stuff About Code” has some excellent information and I’m sure will help me get started. Just need to think of a novel Python idea to try out. Interfacing with real hardware offers some cool possibilities!

  2. Chris says:

    Hello, very useful post. My son is playing it on the Raspberry Pi but is not sure how to save the world he has created. Therefore, he has to start in a new world every time. Is this the way the R-pi version works or is there a way to save your world?

    Regards
    Chris

    • Karl Beykirch says:

      We have the same problem (can’t save worlds). Have you found an answer? Does anyone know?
      Could there be a problem with permissions on one or some of the Minecraft directories?
      Thanks.

      • Karl Beykirch says:

        Well, no one replied at all, but just in case someone finds this: I solved it. The problem was ownership/permissions of the invisible .minecraft directory and subdirectories.

  3. Sam Clayson says:

    When I try to extract the tar file using tar -zxvf minecraft-pi-0.1.1.tar.gz, an error occurs saying:

    tar (child): minecraft-pi-0.1.1.tar.gz: Cannot open: No such file or directory
    tar (child): Error is not recoverable: exiting now
    tar: Child returned status 2
    tar: Error is not recoverable: exiting now

    Any ideas on why this may be?

    • Matt says:

      If it is saying “No such file or directory” then the tar.gz file isn’t there or it’s got a different name. Type “ls” to list the files in the current directory and double-check.

    • Dan says:

      I had exactly the same problem. I found this was because i clicked the download link from the minecraft website. I then followed these instructions from the beginning and it worked no problem. Basically, delete whatever you have now and start again using the steps here!

    • mike says:

      clear out the files that may be already down loaded…use the wget https://s3.amazonaws.com/assets.minecraft.net/pi/minecraft-pi-0.1.1.tar.gz
      right in the terminal don’t send it to a file just type it in and execute. I was having the same issue. Once I did this I was able to decompress the file and it worked! Good luck

  4. Catherine says:

    Hi I’ve got Minecraft working on my R Pi following your instructions above. Only thong that hasn’t worked saving the minecraft.png file . It saves as a blank file. Any suggestions? Thanks!

  5. Gordon Johnny says:

    I get to the part where I put in “./minecraft-pi” and it gives me the following error message: “./minecraft-pi : cannot execute binary file” does anyone know what to do with that?

  6. wrichards says:

    any chance this would work under retropie? or is it set in the raspian windows?

  7. Alex says:

    When I type in that command into LXTerminal it says it’s connecting to s3.amazon.com but then it says Connection refused.

    Did the file get removed?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>