Raspberry Pi Setup
I have a Raspberry Pi v2 which I use for education (CodeClub, kids).
It ran an old Raspbian so things like GPIO support in Scratch were not available.
To make it easier for myself, I put a new SD card with Ubuntu MATE in & set it up the same way as I previously setup my LoRa gateway.
Firstly, I did an initial setup of MATE (timezone, language, computer name and initial user with encrypted home dir).
Then, I ran an upgrade, which took a while.
$ sudo su - $ apt-get update $ apt-get upgrade $ reboot
After the upgrade I resized the file system via System -> Welcome -> Raspberry Pi Information screen.
Lastly, I ran rpi-update:
sudo su - rpi-update reboot
Minecraft Pi & GPIO
When I clicked Applications -> Games -> Minecraft Pi nothing happened.
I opened a new terminal and ran minecraft-pi manually:
$ minecraft-pi * failed to open vchiq instance
I checked rules in /etc/udev/rules.d/. The one that caught my attention was 10-local-rpi.rules which had the following in:
SUBSYSTEM=="vchiq", GROUP="video", MODE="0660"
I checked the user who I setup initially and it wasn’t in video group:
$ groups pi pi : pi adm cdrom sudo dip plugdev ldadmin sambashare
I added the user to the video group:
$ sudo su - $ usermod -a -G video pi
Checked the groups again:
$ groups pi pi : pi adm cdrom sudo dip video plugdev ldadmin sambashare
Minecraft would still not run though, because the group change takes effect only if I’d logged out and log back in again (not from the terminal, but completely).
I rebooted the pi instead.
Once back I clicked Applications -> Games -> Minecraft Pi and voilà, Minecraft started up.
I made a new world and kept Minecraft running.
In the terminal I checked what Python packages I have installed:
$ pip list
I noticed picraft being listed.
I checked it online. It’s an alternative library one can use for Minecraft Pi instead of mcpi.
I gave it a go:
$ python >>> from picraft import World >>> w = World() >>> w.say('ahoj')
Worked as expected. Greeting ahoj appeared in Minecraft.