Learn to Program with Minecraft

Updating MinecraftTools to support the latest version of Minecraft

As part of our Year 7 and 8 Code Cadets programme at Canberra Grammar School we do Minecraft mod programming. There’s a fantastic book which has been published by No Starch Press titled Learn to Program with Minecraftby Craig Richardson. This teaches programming in Python through developing Minecraft mods.

Image courtesy of No Starch Press.

In order to program mods the student needs to run up a local Minecraft server on their computer. Unfortunately, the copy of the downloadable tools from the No Starch Press website have not been updated since March 2016 and only support a fairly old version of Minecraft.

As we wanted to use the latest and greatest version of Minecraft with our students we updated the tools. It was a reasonably straight-forward process, and we wanted to share the process here in case others would like to do the same (there are quite a few reviews on Amazon about this exact topic).

Updating Minecraft Tools

  1. Download MinecraftTools from the No Starch Press website, as per the instructions in the book: https://www.nostarch.com/programwithminecraft . Once downloaded, extract the archive and you should be presented with a folder named MinecraftTools which contains all the files.
  2. Download the latest version of the Spigot BuildTools from the Spigot Jenkins page: https://hub.spigotmc.org/jenkins/job/BuildTools . You should download the “Latest stable build”. This should download a file called BuildTools.jar
  3. You’ll now need to extract the contents of the BuildTools.jar file as we need all the files inside it.
  • Put the BuildTools.jar file inside its own folder called BuildTools
  • Open a text editor (preferably something other than TextEdit, like Sublime Text, Atom, picovim, etc.) and put the following into the file:

    #!/bin/bash
     cd “$(dirname “$0”)”
     exec java -Xms1G -Xmx1G -jar BuildTools.jar nogui

This is a Bash script which will extract the BuildTools.jar file and put its contents into the folder where the BuildTools.jar is located.

  • Save the file as extract.command in the same folder as the BuildTools.jarfile.
  • You now need to grant the file execution rights. Open a Terminal window, type chmod a+x with a trailing space, and then drag the extract.commandfile into the Terminal (which will put the path of the file after that command). Press ENTER and the extract.command now has execution rights.
  • Double-click to run the extract.command file and it will commence extracting the BuildTools.jar file. This will take around 5–10 minutes and does require internet access so packages can be downloaded.
  • Once the script has finished extracting everything from the BuildTools.jar file, go into the MinecraftTools folder (which you downloaded from the No Starch Press website) and open the server sub-folder. Delete any files and folders which are present in the extracted BuildTools.jar folder. This is usually: apache-maven-X.X.XBuildDataBuildTools.jarBuildTools.txt.logBukkitCraftBukkitcraftbukkit-X.X.X.jarSpigotspigot.jar (delete this even though it’s not in the BuildTools folder…you’ll see why shortly), and work.
  • Copy all the files from the BuildTools folder (with the exception of extract.command) into the MinecraftTools folder (essentially replacing the deleted files with these new copies).
  • Rename the spigot-X.X.X.jar file (which should match the latest version of Minecraft) to spigot.jar.

Hope this has helped others who are getting into Minecraft mod programming!

Credits

Thank you to Craig Richardson and No Starch Press for publishing this fantastic book.

Thanks to joshwenke for his instructions at https://www.spigotmc.org/wiki/bbcode.2703/archive about how to extract the files from the Spigot .jar file, which the instructions above are heavily based upon.