Learn to Program With Minecraft on Ubuntu

Update 3/20/2016: Thanks to one of our readers, Fabrizio Fazzino, for pointing out that a software update since these instructions were prepared makes it necessary to modify them. Specifically, we’re changing how the Spigot Server component gets installed & used. I’ve updated the instructions below accordingly.

Also, he’s prepared a more succinct set of instructions that summarizes the steps. If you’re not interested in learning as much about how and why this works,  I’d recommend you check my “Quick Note About Folder Structure” (in the yellow box below) and then follow his instructions in this comment, which Fabrizio was kind enough to post here since his original blog post is no longer accessible to the public.

Recently, I picked up a copy of Learn to Program with Minecraft®: Transform Your World with the Power of Python for my daughter and I to have a fun project to work on together.

Python is a programming language that I’ve long wanted to get acquainted with, and since she loves Minecraft so much, I felt like this book would be an ideal way for my daughter to also gain some exposure to it.

The only problem? We each use the Ubuntu distribution of Linux instead of Windows or Mac OSX.

You wouldn’t think this would be a problem: Minecraft is built in Java, which runs without a problem on Ubuntu (and many other platforms). Python is readily available for Ubuntu. Seems like a no-brainer, right?

Well… not quite. After the Amazon box arrived, I spotted this note on the back cover of the book:

The code in this book will run on Windows 7 or later, OS X 10.10 or later, or the Raspberry Pi. (See the last page for detailed requirements.)

No problem! The Raspberry Pi runs a special distribution of Linux called “Raspbian,” which is a version of Debian Linux, which is the upstream version of Linux that Ubuntu is based on. In other words: Raspbian & Ubuntu are cousins.

It seems reasonable, then, that if you can get this stuff working on the Raspberry Pi, then a much more powerful laptop running Ubuntu should be great!

Even more encouraging, there’s a nifty footnote at the bottom of Page 1 of the Learn to Program With Minecraft book which reads:

For information on other platforms and updates to these instructions, visit https://www.nostarch.com/pythonwithminecraft

Since the book had already been out for a few weeks, this note gave me hope that perhaps some instructions for setting up all the tools on Ubuntu might’ve already been added. Unfortunately, this is not the case (yet, anyway).

So… I decided to try to do it anyway. Since author Craig Richardson and the No Starch Press team had prepared download packages for the Mac & Windows platforms, I figured that at the very worst, there would be some clues in those packages that might help me get going.

Getting Minecraft & Python Set Up On Ubuntu

First, here is a simple set of requirements (as I understand them) for you to be able to use the instructions in the Learn to Program With Minecraft book on Ubuntu:

  • Minecraft – this is the game itself. If you don’t already have a license for the game, you’ll need to pick one up and install it. “Installing” Minecraft for Ubuntu is quite easy: simply download the .jar file from your Mojang account and launch it. We had done this long ago, so this step was already completed for us.
  • Python – This is the programming language you’re learning. More on finding & installing it in a moment.
  • Java – while you probably have a basic interpreter (the “runtime environment”) for Java already, you’ll need the Java Development Kit to run this next tool..
  • Spigot Server – This is Minecraft “server” software, which you can run on the same computer that Minecraft will run on. You need this because the Python connection to Minecraft relies on a server plugin that you can’t just run with your plain old Minecraft installation.
  • Minecraft Python API (py3minepi) – It turns out that this connection between Python and Minecraft was originally developed especially for the Raspberry Pi. The way I understand it, this tool is an API for Minecraft that works with Python. You need it.
  • Raspberry Juice Some brave souls created Raspberry Juice as a way to run the Python/Minecraft connection on other platforms (not just the Raspberry Pi).  When you follow the instructions in the book for Windows or Mac, this little gem is bundled in. But if you’re installing from scratch for Ubuntu, you’ll need to get it yourself. Not realizing this, I installed all the other tools and ran into a really nasty error that I couldn’t get around:

This error message was the part of the installation that was trickiest to resolve, but after a bit of digging, I was able to work it out.

The detailed instructions for each of these items follows (below). The one note I’d like to insert here is this:

I’m using Ubuntu 14.04 LTS, so your installation steps may vary somewhat if you’re using a different Ubuntu version.

Installing Python 3

You actually need 3 separate items that fall under the Python 3 heading:

  • Python 3 (the programming language itself)
  • IDLE (the development environment for Python, a/k/a the place where you’ll type commands and write programs)
  • PIP (the “package manager” for Python). You need this to install

For packages that are developed for Ubuntu, I tend to prefer using the “Ubuntu Software Center” to install stuff like this.

The only “gotcha” with Python is that there are a number of software versions and tools and so forth. So… launch the Software Center and search “python3” (with no space).

You should see a listing that says something like, “Interactive high-level object-oriented language (default python3 version)”

That’s the one you want. Do yourself a favor and click on “more info” so you can check the box for “IDLE 3” while you’re at it.

Install those, then run a similar search for “python3-pip” so you can use the package manager.

Prefer the command line to the Software Center?

Here are the commands to get python installed if you’d rather do this than use the Software Center. You’ll need to open a terminal to run these:

sudo apt-get install python3
sudo apt-get install idle3
sudo apt-get install python3-pip

You’re set with Python!

Installing Java 7

With Ubuntu, as is often the case, you have options here. You definitely need the Java SE SDK version 7 (presumably something newer would work as well) for the Spigot server to run.

Details on your options for Java on Ubuntu are here.

I used openjdk-7.

From the Ubuntu Software Center, just search “openjdk-7” and look for the “headless” option (this is lighter weight because it doesn’t include a GUI).

Or from the terminal:

sudo apt-get install openjdk-7-jre-headless

Installing Spigot Server

Update 3/20/2016 As I mentioned in the update at the top of this post, Spigot Server has released a new version: 1.9. Since the other components we’re using have not yet (as of today) updated to accommodate this, you’ll need to make sure that you download Spigot 1.8.8 and use it even though it is not the most recent version available.

Spigot is one of the most popular Minecraft server options, and is a necessary component in order to get Python & Minecraft talking to each other.

Getting the server software up & running is a matter of compiling the latest version. This reference page from the Spigot wiki is the one I used, and it seems to stay up to date. However, since it contains the instructions for multiple platforms, I’ll endeavor to simplify here.

One item to install first that will make this simpler is git. You’re going to need a terminal window anyway, so I’d recommend going ahead and opening it now and running this command to install git:

sudo apt-get install git

Next, you’ll want to download the Spigot BuildTools from this location:
https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar

A Quick Note About Folder Structure

To help make things easier on yourself, you might find it useful to use a somewhat similar folder structure to the one described in Learn to Program with Minecraft for the Windows & Mac users.

To accomplish this for myself, I opened the “Files” application and browsed to my “Documents” folder, then created a new folder called “MinecraftPython”, then inside that folder another called “MinecraftTools”.

I recommend moving the BuildTools.jar file that you just downloaded into that “MinecraftTools” folder.

To do this, you have a few options:

  • You can drag and drop using 2 “Files” windows, or
  • you can cut & paste if you just have one of those windows open.
  • Otherwise, you can move the file from the command line in a Terminal window with something like: mv ./Downloads/BuildTools.jar ./Documents/MinecraftPython/MinecraftTools/BuildTools.jar. Of course, you’ll need to modify that command to suit your particular situation (if you’re using a different folder structure or starting from a different location in your Terminal window than I did, for example).

Once that’s done, from your Terminal window, you’ll need to change directories to the location of your BuildTools.jar file. Depending upon where you’re starting from, that might mean a command that looks something like: cd ./Documents/MinecraftPython/MinecraftTools.

Then you’ll want to execute these 2 commands:

git config --global --unset core.autocrlf

java -jar BuildTools.jar This needs to be tweaked to make sure you use version 1.8.8 of the Spigot Server component (for now).

java -jar BuildTools.jar --rev 1.8.8

This will get the Spigot Server built. In order to finish installing, creating a startup script will be helpful. You can create one with gedit by running a command like this:

gedit start.sh

The gedit text editor will open. Copy and paste this into the editor:

#!/bin/sh

java -Xms512M -Xmx1024M -XX:MaxPermSize=128M -jar spigot-1.8.8.jar

Note: the filename “spigot-1.8.8.jar” was the current filename as of this writing. You’ll need to confirm that filename based upon your build, and edit the command here if it’s different use that filename as is for now (until the other components are updated to accommodate newer versions of Spigot server). Also, the Spigot instructions specifically note that the ‘MaxPermSize’ directive is no longer needed or supported in Java 8, but since I’m using Java 7, I left it in mine.

Save the file and close gedit.

Next, you’ll need to make the script executable. From the same terminal window, type:

chmod +x start.sh

Before you launch this file, you’ll need to accept the End User License Agreement. Locate the eula.txt file in your “MinecraftTools” folder and open it for editing. You can do this from a terminal window by typing gedit eula.txt . From the “Files” application, you can right-click the eula.txt file and choose the option to edit it with gedit.

Before you change the line that reads eula=false to eula=true, you’ll want to review the Minecraft End User License Agreement and verify that you’re ready to agree to its terms. Once you are, changing the value to “true” and saving the file will allow you to launch the Spigot Server without a hiccup (assuming that it is installed correctly).

Starting Your Spigot Server

Once that’s completed, you can start the Spigot Server to ensure it’s working properly. You’ll use this same command start the server each time you need to use it:

./start.sh

If all has gone according to plan, you should see the output of the server startup process in your terminal window. The Spigot Server will create a new Minecraft world as it launches, and once it’s up and running, you’ll see a > prompt with a flashing cursor next to it. You need to keep this window open.

Testing Your Spigot Server Installation

To test your server, launch Minecraft as usual.

Click “Multiplayer” and then choose “Add Server”

Give your new local server a name. The book recommends Minecraft Python World for it. In the “Address” box, type localhost. There’s a picture at the top of page 17 of the book which you can refer to as an example.

Quick note: if you’re using a typical Minecraft installation, then your Minecraft version will have updated by now to a version newer than the Spigot Server version. If so, you’ll need to edit your “Profile” and specify the Minecraft version to run so that it matches your Spigot Server version (1.8.8 if you’re following this writing exactly). Alternatively, you can create a new profile instead (this is what I chose to do) so that your main Minecraft profile continues to use the latest Minecraft version.

You can double-click the Minecraft Python World and check out your new world.

Note: The author’s downloads for Mac & Windows operating systems are pre-configured to be in Creative Mode. This world will be in Survival Mode instead. This can be changed by editing the server.properties file in your “MinecraftTools” folder and changing the line that reads gamemode=0 to gamemode=1 . You may also find that you need to change the line that reads force-gamemode=false to force-gamemode=true .

Play as long as you like, but before proceeding: you’ll want to stop the Spigot Server. In the window with the flashing cursor, simply type stop at the > prompt, and the Spigot Server will save everything and shut itself down.

Installing the Minecraft Python API

Next, you’ll need the Minecraft Python API. There’s a Github repository here:

https://github.com/py3minepi/py3minepi

I recommend just hitting the “Download Zip” button there. The file will be saved to your “Downloads” folder. You’ll want to extract the .zip file’s contents. You’ll end up with a folder called py3minepi-master, which we need to copy into the “Documents/MinecraftPython/MinecraftTools/” folder.

Once the folder has been relocated to the “MinecraftTools” folder, we need to run a command to install it. From your terminal window (assuming your current directory is still the “MinecraftTools” folder), type:

sudo pip3 install ./py3minepi-master

Installing Raspberry Juice

The last piece, I believe, is the actual Raspberry Juice plugin for Spigot. You can find it on the project’s home page:

http://dev.bukkit.org/bukkit-plugins/raspberryjuice/

Look for the “Recent Files” link on the right. As of this writing, the latest was RaspberryJuice v1.7 for 1.8.1. Follow the links, and eventually, you’ll end up with a .jar file.

This file needs to be copied into the “plugins” folder of your Spigot Server installation. If you’re following the directions here specifically, then you’ll find that folder at “/Documents/MinecraftPython/MinecraftTools/plugins”

Put the .jar file in that folder. Your Spigot Server will automatically find it the next time it starts up.

Time to Test!

If all has gone well, you should be ready for the “Getting to Know IDLE” section of the setup instructions on Page 20 of the book. If you’re able to successfully run the tests there, you’ve got everything set up correctly!

It was at this stage that I got that nasty error I mentioned earlier:

ConnectionRefusedError: [Errno 111] Connection refused

after typing this command into IDLE:

mc = Minecraft.create()

When I got the “connection refused” error, I did a bunch of searching, but nothing seemed to fit. Ultimately, I hunted down the port number that the “minecraft.py” script was trying to connect to (port 4711). This didn’t make any sense, because the Minecraft server software defaults to port 25565. Searching around for information about what might be running (or not running, in my case) on port 4711 was what yielded the information about the Minecraft Python API.

Thankfully, author Craig Richardson left some clues for us in the pre-packaged downloads he made available for Windows & OSX. On my Ubuntu system, I opened up the download he prepared for OSX (since OSX and Linux are more or less cousins, I figured it would be worth a shot) and found Raspberry Juice. It was perhaps the least obvious component of this whole setup.

So far, this setup has been working for me. I’m not 100% certain that I haven’t missed something, but if I have, then it doesn’t appear to be affecting things so far.

I hope you find this helpful! Let me know what you run into in the comments. I’ll do my best to help!

37 Replies to “Learn to Program With Minecraft on Ubuntu”

    1. Hey Fabrizio,

      I’m really glad you found the instructions useful and you were able to get your setup working! Software updates are always going to have the potential to create snags, so thanks for pointing out the Spigot update and its ramifications. I’ve updated my post accordingly, but also linked out to your far more succinct instructions.

      I hope you and your daughter enjoy learning to program with Python using Minecraft and Ubuntu! I’ve started to tinker some, but haven’t yet pulled my daughter into it. It would be great to hear how it goes for the two of you!

      Cheers,

      David

  1. Thanks a lot! Please also remember to inform users that they have to select “Edit Profile” in the Minecraft Launcher so that they can select the correct version (“revision 1.8.8”).
    Cheers!
    — Fab

    P.S. I don’t think it will be that easy to pull my daughter into it very easily, but it’s worth a try anyway!

  2. Hi. I struggled with this very problem running on 14LTS Ubuntu. For me, the problem was not in any of the modules, but instead it was the version of Java. The Spigot Raspberry module was compiled with Java 8, apparently. So while Minecraft itself would run just fine with Java7, Spigot would crash while attempting to load the Raspberry Juice module.

    The “ConnectionRefusedError: [Errno 111] Connection refused” was a hint, but ultimately a red herring, but it led me to this page and pointed me to the right places to dig deeper. Looking at the Spigot output, I saw “Java Unsupported major.minor version 52.0” in the error log. That means java7/java8 incompatibilities. As best I can tell, the Raspberry Juice module is built with Java8, so if one has only java7 installed, that module fails to load, the errors trickle up and get reported as “error 111 ConnectionRefusedError at the Spigot level.”

    So for me, the fix was to apt-get remove the version 7 jre, Lsudo apt-get autoremove to clean up loose ends, then install Java 8 JRE (https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get)

    tl;dr version: for those getting this error on Linux, install java 8.

    Hope this helps others in a similar situation.

    1. @JTurner Spigot is running but when I go to python3 console I entered
      >> from mcpi.minecraft import Minecraft
      no error
      then tried
      >>mc = Minecraft.create()
      and got the dreaded
      [Errno 111] Connection refused
      FWIW I AM running

      I checked the java v.
      $sudo update-alternatives –config java
      and running

      /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
      but no joy….
      [Errno 111] Connection refused

      FWIW. I’ll keep digging around trying to find a fix.

      thanks anyway for sharing your post/success!

      best
      Dennis

      1. @Dennis & @JTurner — thanks for posting your issues & findings here. I’ll admit to not staying 100% on top of this in the last couple of months.

        For the record, the Raspberry Juice Github page shows an update to version 1.8 (of Raspberry Juice), which appears to have been intended to provide support for Minecraft 1.9. The readme.md file there doesn’t mention a change to Java 8, but I was definitely using Java 7 when I wrote this post and got everything working.

        So… it still seems like this project isn’t quite for the faint of heart.

        Over the weekend, I updated my Ubuntu install to LTS 16.04 and I haven’t yet had the heart to try to see if any/all of this installation is working.

        I’ll post my findings here as soon as I’ve tried, and my intention is to take a deeper look at the issues and see if I can learn anything useful.

        In the meantime, any updates about your progress are more than welcome here! Thanks!

    2. @JTurner
      I wish I had read your comment earlier! I went on a wild goose chase trying to solve it, and ultimately led me to discovering this…which you clearly and perfectly explained!

  3. Thanks for the instructions as we are also on Ubuntu 14.04LTS. Everything seemed to download fine and I was able to test the Python setup without error, but when I went to run the first program teleport.py on page 35 of the book, I am getting the following error:
    Traceback (most recent call last):
    File “/home/schroeder/Documents/MinecraftPython/Variables/teleport.py”, line 11, in
    mc.player.setTilePos(x,y,z)
    File “/usr/local/lib/python3.4/dist-packages/mcpi/minecraft.py”, line 72, in setTilePos
    return CmdPositioner.setTilePos(self, [], args)
    File “/usr/local/lib/python3.4/dist-packages/mcpi/minecraft.py”, line 46, in setTilePos
    self.conn.send(self.pkg + b”.setTile”, id, intFloor(*args))
    File “/usr/local/lib/python3.4/dist-packages/mcpi/connection.py”, line 41, in send
    self._send(s)
    File “/usr/local/lib/python3.4/dist-packages/mcpi/connection.py”, line 51, in _send
    self.socket.sendall(s.encode())
    AttributeError: ‘bytes’ object has no attribute ‘encode’

    Also tried to simply getTilePos() and similar error. Any help would be appreciated.

    1. Yikes, @Schroeders — it looks like I missed your comment when you posted it. Any news? I’m going through my installation and updating things very soon… will see what I can learn about the problem you mentioned.

      Cheers!

  4. I’m getting connected to the server but whenever I try to call any API on the player object (getPos(), getTilePos()) it enters an infinite loop of reading empty data from the socket:

    Drained Data:
    Last Message:

    Drained Data:

    Last Message:

    Drained Data:

    Last Message:

    Drained Data:

    Last Message:

    Drained Data:

    Last Message:

    Drained Data:

    Last Message:

    Drained Data:

    Last Message:

    Drained Data:

    I’m guessing something is up with the config of default spigot or the spigot server that comes with the book’s MinecraftTools files, but the key missing piece isn’t immediately clear to me…

    1. I hope you read this! I had this exact same problem! Please see my other comment further below. If you’ve changed the port # in minecraft.py to 25565, change it back to 4711. You’re not connecting to the minecraft server, you’re connecting to RaspberryJuice serve socket created when you run the main Minecraft spigot server. Correct port is 4711.

      It’s likely that your RaspberryJuice.jar plugin is not loading with the server. Check your server logs, near the top, you may not notice the error when starting the server because the output scrolls so quickly. Confirm that you’re running the latest version of Java. My error read ‘org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: net/zhuoweizhang/raspberryjuice/RaspberryJuicePlugin : Unsupported major.minor version 52.0

      The key information is ‘version 52.0’ from the Java Class File you can see that requires 1.8
      https://en.wikipedia.org/wiki/Java_class_file

      Also the ‘at java.lang.Thread.run(Thread.java:695) [?:1.6.0_65]’ at the end of the error is another clue. It should be [?:1.8_x_xx] if you’re running the latest version of Java. I was running 1.6 and should have been running 1.8.

  5. I was getting connection errors and landed on this page. After quickly glancing through it, I concluded the problem was with the socket port being incorrect in minecraft.py module of Minecraft Python (mcpi)
    I changed it from 4711 to 25565 to match the minecraft server.
    *DO NOT DO THIS*

    It fixed the connection issues but mcpi did not work and had very strangle behavior. The commands would be sent and received but minecraft would not respond. If I tried the command again, I would get an infinite loop (like the poster above)

    Drained Data:
    Last Message:

    Drained Data:

    This lead me to start poking around connection.py and I concluded there was a bug in the buffer read drain() function. It needed a break at the end of the While(true) loop. This stopped the infinite loop but did not make minecraft respond to the commands. Eventually the server would boot me after too many erroneous commands.

    ***Ultimately, all of this work was a red herring!***

    The *real* problem was RaspberryJuice (a server plugin for SpigotMC server) was not loading.
    After poking through the spigot logs I noticed this error near the very top which I had not noticed before.

    Could not load ‘plugins/RaspberryJuice.jar’ in folder ‘plugins’
    org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: net/zhuoweizhang/raspberryjuice/RaspberryJuicePlugin : Unsupported major.minor version 52.0

    The key information is ‘version 52.0’ from the Java Class File you can see that requires 1.8
    https://en.wikipedia.org/wiki/Java_class_file

    I was running Java 1.6 and RaspberryJuice.jar was compiled (requires?) 1.8. Once I updated Java and changed the port back to 4711 in minecraft.py everything is working normally.

    I now see someone above posting the exact same info. I wish I had read all of the comments thoroughly. -_-

    1. Hi Justin, thanks so much for jumping in here and sharing your experience.

      I think I might need to do a little updating and cleanup to this post… the version problems were definitely not an issue when I first wrote this up.

      Great work on the troubleshooting. Thanks again!

  6. Hi, although I’m running this on a windows 10-machine I have ran into the same problems as you have. Today I finally got it to work!
    As you say, the files at the nostarch website are outdated, so I had to download and install Spigot by myself. I then ran the installation of Python, and then the Python api provided by nostarch, and I figured I was ready to go.
    But I got the same ConnectionRefusedError as you did, and tried to change the port number, as you did, and got the “Last Message: Drained Data:”-loop that you did.
    After reading Justins post I realised that I hadn’t put any raspberryjuice.jar file in the plugin folder. When I downloaded that, put it in the plugins folder everything started to work. 4711 is the right port as Justin says for Python to communicate with the Raspberry Juice plugin, and your error seems to come from not getting the Raspberry Juice plugin to function properly.
    One note more – I had to change the online-mode to false in the server.properties file, otherwise the computer tried to contact Mojang on localhost, which naturally doesn’t work.
    Now I’m ready to show this to my son. Let´s hope he’ll show some interest!

  7. Thank you so much for this guide. I was having issues with getting the Minecraft Python API to work with our version of MinecraftEDU and your guide was able to help me get past the connection issue. Much appreciated!

  8. Hey David,
    thanks so much for this step by step instruction for programming on Minecraft through our beloved LinuxOS.

    I wanted to update this thread saying that I followed all the steps and, everything is fully working with this newer software versions:
    – Ubuntu 16.04 LTS
    – Spigot 12.2
    – raspberryjuice-1.11.jar
    – py3minepi (30th Jun 2015)

    The biggest obstacle for me has been to install py3minepi within the proper python3 instead of 2.7 (where it was “locked” on my machine). I solved with this https://stackoverflow.com/questions/11268501/how-to-use-pip-with-python-3-x-alongside-python-2-x

  9. Hi Daniel, unfortunately I disabled my blog a long time ago. I will try to post the instructions here. Please note that after all these years they might require some further tweaking.

    2016-03-20
    Learn to Program with Minecraft on Ubuntu

    I’ve recently bought my 10-year-old daughter the book “Learn to Program with Minecraft”. It seems to be a great book to start learning programming in Python, especially for kids who love playing with Minecraft.

    Unfortunately there’s a number of software packages to install, and the instructions are only available for Windows PCs, Apple Macs and the Raspberry Pi (which comes with everything pre-installed), and as my tri-boot iMac boots into Ubuntu Linux by default, I wanted to set them up on this OS.

    Fortunately I found this excellent guide written by David G. Johnson, which explains step-to-step how to get started on Ubuntu. The bad news is, the instructions didn’t work straight away for me, because the versions of the packages involved have moved on since he wrote that blog post, so I’ve spent a few extra hours to get it sorted.

    I’ll try to write down a summary of the instructions here, and then I will explain why as of today one can’t simply follow David’s guide as is.

    # Install Java 8, Python 3 and friends
    sudo apt-add-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java8-installer
    sudo apt-get install python3
    sudo apt-get install idle3
    sudo apt-get install python3-pip
    sudo apt-get install git

    # Compile the Spigot server, please note –rev 1.8.8
    wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
    git config –global –unset core.autocrlf
    java -jar BuildTools.jar –rev 1.8.8

    # Configure the Spigot server in a few “simple” steps:
    # 1) Start it, it will crash because you haven’t accepted the EULA license:
    java -Xms512M -Xmx1024M -jar ./spigot-1.8.8.jar
    # 2) Edit file “eula.txt” just created in the current directory and replace “eula=false” with “eula=true”
    # 3) Start again Spigot with the same command shown in 1), this time it will work. Type in “stop” at the prompt to make it exit again. This step is required to create the “server.properties” file and the “plugins” directories, which will be needed later on.
    # 4) Edit the file “server.properties” to change “gamemode=0” to “gamemode=1”, and “force-gamemode=false” to “force-gamemode=true” (this is to start in Creative Mode rather than Survival Mode, or your child will soon get upset).

    # Download and install the Python Minecraft API
    wget https://github.com/py3minepi/py3minepi/archive/master.zip
    unzip master.zip && rm master.zip
    sudo pip3 install ./py3minepi-master

    # Download Raspberry Juice and put it in the “plugins” folder of the Spigot server
    wget http://dev.bukkit.org/media/files/875/204/raspberryjuice-1.7.jar
    mv raspberryjuice-1.7.jar plugins

    # Download Minecraft and make sure you have a paid-for account you can play with, for instance in Single-Player mode
    wget https://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar
    java -jar Minecraft.jar

    # Now you should be ready to go, without any automation script you would have to do the following every time:
    # 1) Start the Spigot server and leave it running (one of the last few lines scrolling on the screen should mention Raspberry Juice):
    # java -Xms512M -Xmx1024M -jar ./spigot-1.8.8.jar
    # 2) From another terminal, start Minecraft:
    # java -jar Minecraft.jar
    # 3) In the Minecraft Launcher (the first screen you get when you start the program) select “Edit Profile” and then from the “Use version” drop-down menu select “release 1.8.8”.
    # 4) In Minecraft select “Multi-Player”, then add a server, name it “Minecraft Python World”, select host name “localhost”, press “Done” and then click the play icon to join it.
    # 5) Free the mouse pointer from Minecraft by pressing “Esc”, then from a third terminal start IDLE, the Python Shell & Text Editor:
    # idle3 &
    # 6) Copy these commands in the IDLE Python Shell and verify that you don’t get any error and your player gets teleported to the coordinates specified:

    from mcpi.minecraft import Minecraft
    mc = Minecraft.create()
    mc.player.setTilePos(0, 120, 0)

    # If everything works fine, you may want to create a script for your child to start Spigot, Minecraft and IDLE. This is a sample script:

    #!/bin/bash -e
    idle3 &
    xterm -e ‘java -Xms512M -Xmx1024M -jar ./spigot-1.8.8.jar’ &
    xterm -e ‘java -jar Minecraft.jar’ &

    Unfortunately double-clicking the script didn’t start it as expected, so I created a desktop icon named Minecraft.desktop with the following content:

    [Desktop Entry]
    Type=Application
    Terminal=true
    Name=Minecraft
    Icon=/download/some/icon/from/the/web/minecraft.png
    Exec=bash -c ‘/absolute/path/to/previous/script.sh;$SHELL’
    Categories=Application;

    Ok, now as promised a brief explanation of what I’ve had to change compared to David G. Johnson’s instructions.

    If you build Spigot today, by default you get version 1.9; at the time of writing, there’s no Raspberry Juice available for this server, the latest version being “Raspberry Juice 1.7 for Spigot / CraftBukkit 1.8.1”.
    As such, when building Spigot using my instructions, you have to override the default with option “–rev 1.8.8”; and when starting Minecraft you have to specify in the drop-down menu of the Minecraft Launcher that you want to use the same version, “release 1.8.8”.
    Apart from this, his instructions worked beautifully, so you may want to follow his guide. Thanks David!

    About my daughter and the book, we’ve just started and I still don’t know if she will get a grasp of Python anytime soon; but the whole kit costs around 35 GBP (half of which for the book and the other half for the Minecraft license), so it’s not much; or maybe just the price of the book if you already have a PC/Mac/Linux license and/or own already or plan to buy a Raspberry Pi, which as I said comes with everything pre-installed.

    1. Wow, Fabrizio! Thanks so much for re-posting the instructions from your blog here. My apologies to you and Daniel both for being a little slow to moderate comments. With all the links and the overall length of your comment, it apparently didn’t make it past the filters.

      In any case, it’s live now and I’ll try to stay more on top of these in case Daniel or other readers have additional questions. Given how frequently software gets updated these days, maintaining a current set of instructions is tricky. I haven’t gone back to these in quite some time, but I may try to do that in the not-too-distant future, especially if there’s interest from anyone who’s trying to get this set up.

      Thanks again!

Leave a Reply