88 LXF257 December 2019 http://www.linuxformat.com
CODING ACADEMY Hacking Minecraft
make sure you’ve got Python installed: the command
sudo apt-get install python should suffice for any
Debian-based distro (after doing a sudo apt-get update,
of course).
It’s always best to backup your Minecraft folder first
before making any changes. It can be found hidden in
your /home as .minecraft. The keyboard shortcut
Ctrl+H can be used in most file explorers to show
hidden directories, or use ls -la if you’re not a fan of the
GUI. In a terminal window mv ~/.minecraft ~/minecraft-
backup should suffice to save a hidden backup
(remember to remove this later if you don’t need it, as
it’ll only take up extra space).
Extract the new .minecraft directory from
McPiFoMo directly into your Home directory. You may
need to sudo apt-get install unrar if your system
doesn’t recognise the RAR file. unrar xe McPiFoMo.rar
~/.minecraft should then do the trick. If you have
his issue sees the last in our series of Minecraft
Python coding tutorials. Over the last six
issues, we’ve looked at integrating Python
code into Minecraft, giving us the creative freedom to
produce all kinds of wonderful monstrosities.
We’ve looked at how to move our character around
the world (see LXF252) using code, building blocks with
code and automatically building prefabricated
creations. We experimented with Turtle graphics
(see LXF255), pixel art and vector graphics (see LXF256)
in Minecraft. We even designed our own graphical user
interface, with buttons to spawn buildings (see LXF254)
in our Minecraft worlds.
Minecraft could be considered one of the most
creative video games of our time, with virtual
environments spanning acres of procedurally generated
random biomes. The world and its contents are left to
the player’s imagination. However, in Minecraft one’s
creativity is usually limited to the in-game tools
provided. Now, thanks to the release of the Raspberry
Pi version of Minecraft, we’re finally able to hook
directly into the API with Python and program away to
our heart’s content.
Combining Raspberry Pi Jam, developed by
Alexander Pruss, with the community project Forge
we’re able to use the Raspberry Pi Minecraft API on
Linux. We’ve put together a package called McPiFoMo
(Minecraft Pi Forge Mod) that does all of this for you at
http://rogerthat.co.uk/McPiFoMo.rar. McPiFoMo
includes MCPiPy by fleap and bluepillRabbit.
You will need to set up and prepare your Minecraft
installation with McPiFoMo. However, if you’re using the
Minecraft Pi edition on a Raspberry Pi, no additional
software is necessary.
Prep and install
Download and install the appropriate version of
Minecraft for your distro of choice. Developers Mojang
offers pre-packaged solutions for Debian/Ubuntu and
Arch (DEB and AUR respectively), and a generic java
version for everyone else at http://www.minecraft.net/
en-us/download/alternative. Next, you’ll want to
Scanning a network for other computers running Minecraft, ready
for us to take over with our hacks.
Hacking Minecraft
games with Python
Calvin Robinson demonstrates how to use Python to hack into a
friend’s Minecraft game and create a chatbot.
Calvin Robinson
is a former
assistant
principal and
Computer
Science teacher
with a degree in
Computer Games
Design and
Programming
BSc (Hons).
T
MINECRAFT
OUR
EXPERT
As fun as it is
to hack into
a friend’s
Minecraft
game, please do
remember to
get permission
from your
friend before
you do anything.
CODING ACADEMY
88 LXF257 December 2019 http://www.linuxformat.com
makesureyou’vegotPythoninstalled:thecommand
sudo apt-get install python should suffice for any
Debian-based distro (after doing a sudo apt-get update,
of course).
It’s always best to backup your Minecraft folder first
before making any changes. It can be found hidden in
your /home as .minecraft. The keyboard shortcut
Ctrl+H can be used in most file explorers to show
hidden directories, or use ls -la if you’re not a fan of the
GUI. In a terminal window mv ~/.minecraft ~/minecraft-
backup should suffice to save a hidden backup
(remember to remove this later if you don’t need it, as
it’ll only take up extra space).
Extract the new .minecraft directory from
McPiFoMo directly into your Home directory. You may
need to sudo apt-get install unrar if your system
doesn’t recognise the RAR file. unrar xe McPiFoMo.rar
~/.minecraft should then do the trick. If you have
hisissueseesthelastinourseriesofMinecraft
Pythoncodingtutorials.Overthelastsix
issues,we’velookedatintegratingPython
codeintoMinecraft, givingusthecreativefreedomto
produceallkindsofwonderfulmonstrosities.
We’velookedathowtomoveourcharacteraround
theworld(seeLXF252) usingcode,buildingblockswith
codeandautomaticallybuildingprefabricated
creations.WeexperimentedwithTurtlegraphics
(seeLXF255), pixelartandvectorgraphics(seeLXF256)
inMinecraft. Weevendesignedourowngraphicaluser
interface,withbuttonstospawnbuildings(seeLXF254)
inourMinecraftworlds.
Minecraftcouldbeconsideredoneofthemost
creativevideogamesofourtime,withvirtual
environmentsspanningacresofprocedurallygenerated
randombiomes.Theworldanditscontentsareleftto
theplayer’simagination.However,inMinecraftone’s
creativityisusuallylimitedtothein-gametools
provided.Now,thankstothereleaseoftheRaspberry
PiversionofMinecraft, we’refinallyabletohook
directly into the API with Python and program away to
our heart’s content.
Combining Raspberry Pi Jam, developed by
Alexander Pruss, with the community project Forge
we’re able to use the Raspberry Pi Minecraft API on
Linux. We’ve put together a package called McPiFoMo
(Minecraft Pi Forge Mod) that does all of this for you at
http://rogerthat.co.uk/McPiFoMo.rar. McPiFoMo
includes MCPiPy by fleap and bluepillRabbit.
You will need to set up and prepare your Minecraft
installation with McPiFoMo. However, if you’re using the
Minecraft Pi edition on a Raspberry Pi, no additional
software is necessary.
Prep and install
Download and install the appropriate version of
Minecraft for your distro of choice. Developers Mojang
offers pre-packaged solutions for Debian/Ubuntu and
Arch (DEB and AUR respectively), and a generic java
version for everyone else at http://www.minecraft.net/
en-us/download/alternative. Next, you’ll want to
Scanning a network for other computers running Minecraft, ready
for us to take over with our hacks.
Hacking Minecraft
games with Python
Calvin Robinsondemonstrates how to use Python to hack into a
friend’sMinecraftgame and create a chatbot.
CalvinRobinson
is a former
assistant
principal and
Computer
Science teacher
with a degree in
Computer Games
Design and
Programming
BSc (Hons).
T
MINECRAFT
OUR
EXPERT
Asfunasit is
tohackinto
a friend’s
Minecraft
game,pleasedo
rememberto
getpermission
fromyour
friendbefore
youdoanything.
CODING ACADEMY