Here's a step-by-step to get started scripting Minecraft with Python on Mac OSX
There was a special build of Minecraft for the Raspberry Pi called Minecraft Pi that had a Python interface and library. You could code in Python to manipulate your Minecraft world! But you'd have to code on a Raspberry Pi computer. However thanks to using the RaspberryJuice plugin with a Spigot server, you can do this locally on a Mac. Probably in Linux or Windows too, but I'll leave that up to you.
Here we have a rainbow created by the rainbox script.
# guide for Minecraft v1.13.1 server
# update minecraft server and spigot links for latest versions
# get started
mkdir minecraft_py; cd minecraft_py; mkdir spigot; cd spigot
# download minecraft server from https://minecraft.net/en-us/download/server/
wget https://launcher.mojang.com/v1/objects/fe123682e9cb30031eae351764f653500b7396c9/server.jar
# download spigot server from https://getbukkit.org/download/spigot
wget -O spigot.jar https://cdn.getbukkit.org/spigot/spigot-1.13.1.jar
# agree to eula
echo eula=true > eula.txt
# get RaspberryJuice from https://dev.bukkit.org/projects/raspberryjuice
mkdir plugins; cd plugins
wget -O raspberryjuice-1.11.jar https://dev.bukkit.org/projects/raspberryjuice/files/2496319/download
# get the mcpi libraries from https://github.com/zhuowei/RaspberryJuice
cd ../..
git clone https://github.com/zhuowei/RaspberryJuice.git
mkdir py
cp -r RaspberryJuice/src/main/resources/mcpi/api/python/modded/mcpi py/
# download an example python script from https://www.dropbox.com/s/k29ms42nzvgehjk/rainbow.py?dl=0
# alternatively see example here https://dev.bukkit.org/projects/raspberryjuice
cd py
wget -O rainbow.py https://www.dropbox.com/s/k29ms42nzvgehjk/rainbow.py\?dl\=1
# run spigot
cd ../spigot; java -jar spigot.jar
# in a new terminal under the minecraft_py/py folder
python2 rainbow.py
Start minecraft making sure the version matches (1.13.1 in this case), go into multiplayer mode, add a server with address: localhost
Connect, look around you, and you'll see the rainbow!
Want a first challenge? try making the rainbow thicker =)
- Set up to run automatically, https://github.com/Ahtenus/minecraft-init
- See more examples!
- See the list of commands implemented at https://dev.bukkit.org/projects/raspberryjuice
- See the Minecraft Pi protocal at https://wiki.vg/Minecraft_Pi_Protocol
- "stop" at server prompt will close the server
Hi Noah, thanks for posting these instructions!
I'm getting through most of it (it was a bit tricky to set up the right version of Java – I had to download v11 from Oracle, then activate it with these instructions).
However, I'm getting stuck at the very last step:
mcpi/minecraft.py L126-L134
I don't see anything obviously wrong with the syntax at this portion ... any idea what might be wrong?