Minecraft is one of the world’s favorite game legends. Minecraft is available on every platform, and the Raspberry Pi is no exception.
Minecraft: Pi Edition
Great thing when you play Minecraft on Raspberry Pi that is every version of it is completely free. This is unprecedented on other platforms. In addition, Minecraft Pi also allows players to create their own worlds, design their own mods that link the real world and much more. The following article will help you install and run Minecraft Pi on Raspberry Pi easily.
How to install and run Minecraft Pi Edition on Raspberry Pi
Installing Raspbia on Raspberry Pi gives you Minecraft Pi right in the Games section. Minecraft Pi is the core version of the popular survival game, designed to help users understand different programming languages.
Using a Pi running Minecraft, you can interact with the 3D world in Python. In addition to building structures on the normal interface, Pi also allows users to control the world with scripts to create & edit blocks.
Minecraft Pi is similar to the original Pocket Edition versions and only has a “Creative” mode. Therefore, it is not as advanced as the versions you play on other platforms.
Instructions for installing Minecraft Pi on Raspberry Pi
Start the Raspberry Pi, log in, and then type the following command:
This command will run the graphical interface. Click icon LXTerminal to open a terminal window. Use the following command to download the Minecraft pack from the homepage:
wget https://s3.amazonaws.com/assets.minecraft.net/pi/minecraft-pi-0.1.1.tar.gz
Then use the following command to extract the contents:
tar -zxvf minecraft-pi-0.1.1.tar.gz
This has created a folder and you should extract some files from it. Open that folder by typing:
Finally, you can run the application with the command:
The Minecraft Pi window will open and it should look like this:
Click “Start Game” to get started and create a world of discovery.
Minecraft runs at a fixed resolution so your screen may vary depending on the settings. You can maximize the window to its full size, run in full screen mode. However, this may affect the mouse pointer. Therefore, please use the keyboard too.
More desktop icons
Having to type commands every time you want to play is annoying, isn’t it? Then why don’t you create a shortcut on the desktop?
First, save the image to your computer as “minecraft.png, then copy it and move to folder mcpi.
Right click on the LXDE desktop, select “Create New” after “Blank File“.
Name the file “minecraft.desktop“. Click OK and the shortcut file will appear on the desktop.
Right click on the file .desktop new, select “Leafpad“. This file will open in a text editor.”Leafpad“.
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
Use the menu “File“save file and exit”Leafpad“.
Shortcut now has a nice icon and is named “Minecraft Pi Edition“.
Double clicking this icon will open Minecraft.
Use Minecraft
Here are some shortcuts to help you act quickly when playing Minecraft Pi
ESC Stop/Menu
W Move forward
A Move right
S Backwards
EASY Move right
E Show block repository
1 – 8 Select widgets in Quick-bar
Left mouse Destroy block
Right mouse Place block
Spacebar Jump (increase in fly-mode)
Shift Stealth (reduced in fly-mode)
You can use the mouse to change the viewing angle. Scroll if you want to see the items in turn. Left mouse button to select block. When viewing the inventory, you can use the WASD key combination to deselect by pressing Enter to select blocks.
Double-tapping the Spacebar turns fly-mode on or off. You can exit Minecraft Pi by immediately clicking the . sign [x] in the right hand corner of the game window.
Python API
The Python API allows you to control the Minecraft world. By default, the Python API comes pre-installed on the Raspberry Pi. This is a great way to build structure and learn Python at the same time.
Drop blocks as you move
The following code will place a flower behind every step you take:
from mcpi.minecraft import Minecraft
from time import sleep
mc = Minecraft.create()
flower = 38
while True:
x, y, z = mc.player.getPos()
mc.setBlock(x, y, z, flower)
sleep(0.1)
Now take a few steps forward and turn around. You will see the flowers in the back.
Since we use loop while True so this will forever happen every time you move in the Minecraft world. To stop that, press Ctrl + in the Python window.
Or try flying up and see how interesting the flowers you leave in the sky will be:
If you only want flowers to appear when walking on the lawn, use getBlock to find the block style you want:
x, y, z = mc.player.getPos() # player position (x, y, z)
this_block = mc.getBlock(x, y, z) # block ID
print(this_block)
This command tells you where the block is standing (0 is a block in the air). If you want to know what type of block you are on, subtract first from value y and use getBlock() to select the block type.
You now know the ID of the standing block. You can run a loop to see the ID of any block you’re standing on.
while True:
x, y, z = mc.player.getPos()
block_beneath = mc.getBlock(x, y-1, z)
print(block_beneath)
You can use the command if to choose to plant or not to plant flowers.
grass = 2
flower = 38
while True:
x, y, z = mc.player.getPos() # player position (x, y, z)
block_beneath = mc.getBlock(x, y-1, z) # block ID
if block_beneath == grass:
mc.setBlock(x, y, z, flower)
sleep(0.1)
You can turn the cell above it into a lawn like this:
if block_beneath == grass:
mc.setBlock(x, y, z, flower)
else:
mc.setBlock(x, y-1, z, grass)
Now every time you walk on the grass, flowers will appear in the background. If the next block is not grass, it will be turned into grass.
Hope the article is useful to you.
Source link: Instructions for installing and launching Minecraft on Raspberry Pi
– https://emergenceingames.com/