How to get started with Minecraft on Raspberry Pi
World of Pi
Here's how to create your own custom Minecraft world on a Raspberry Pi.
1. Run Minecraft
During the extraction of the archive, a new folder was created, and it's called mcpi. We need to change our directory to mcpi so use the cd command again. Once done, use a command called ls to list the contents of the directory. Look for minecraft-pi – this is the Minecraft application.
2. Play around
To launch Minecraft, enter the following in a terminal: ./minecraft-pi. Have a play with Minecraft, create a new world and when it's ready, use the [W], [A], [S] and [D] keys to move around.
The mouse changes where you look, and the left mouse button destroys blocks, whereas the right one places a block.
3. Get the minecraft-api.py file
In Minecraft, to create objects, we must build them brick by brick. But if we use Python, we can make lots of things quickly.
We need to use the minecraft-api.py file and an application called IDLE. A link to IDLE can be found via the icon on the desktop.
4. Copy files
Make a directory called minecraft-api in your home directory and copy the contents of /home/pi/mcpi/api/python/mcpi (including any folders) to minecraft-api. The easiest way to do this is to use LXTerminal and type
Are you a pro? Subscribe to our newsletter
Sign up to the TechRadar Pro newsletter to get all the top news, opinion, features and guidance your business needs to succeed!
cp -r /mcpi/api/python/mcpi /minecraft-api/minecraft
cp means to copy the files and the -r switch instructs the copy to include any sub directories. Also copy the downloaded tutorial file into this directory, ready for the next step.
5. Add a welcome message
Open the minecraft-api.py file in the IDLE editor and take a look at the code. First, let's change the code that says mc.postToChat ("Hello World") to say "Welcome to the game".
Save your work, start a new Minecraft session using any world, then in IDLE click on 'run' which is in the Run menu. You should see your text on the screen.
6. Drop in your player
Our player has a position, controlled via XYZ co-ordinates. We can check where our player is by using mc.player.getPos() and saving the output to a variable called playerPos, ready for use later.
Another idea is to use mc.player.SetTilePos(x,y,z) to drop your player into the game. We changed y to 50, and the player drops into the world.
Current page: Build better Minecraft worlds
Prev Page Create your own Minecraft server Next Page Advanced world building in Minecraft