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.
Using 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!
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 :
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 :
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 :
Then finally you can run the application using :
The Minecraft window should open and look something like this :
Minecraft 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!
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.
First, 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”.
Double-clicking the icon will launch 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.
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.