The Fugue Counterpoint by Hans Fugal

24Oct/150

An outsider’s view of Minecraft development (Fall 2015)

I'm a programmer and a father. I want to teach my kids programming. My kids love Minecraft. Programmers can write Minecraft mods and plugins. It seems natural to teach my kids to program with Minecraft.

I am not a Minecraft aficionado. I know the game, sure, and I can even make it through the first night in survival mode. But to me it's just a game in the periphery of my consciousness. So I was dismayed when I started looking into writing Minecraft code, and discovered that keeping up with the various ways you can code in the Minecraft ecosystem requires a level of fanaticism and devotion that I just don't have. And unfortunately there is no page out there that covers the pros and cons of the various options, not really even one that is out of date. And the landscape has changed considerably in the past 1.5 years.

This is me writing such a post, for this moment in time, for those people who are programmers and familiar with Minecraft but are not Minecraft fans who already know the various plugin and mod frameworks by reputation as users.

Client and server are the two easiest concepts. They're exactly what you'd think. Hooray!

A mod is something that changes the behavior of the server (usually) or the client (less often) or both. Usually very hacky, i.e. developed against decompiled Java classes, and you trick Java into loading your classes instead or in addition to the usual Minecraft code. This is low-level hackery, made a little easier by Minecraft being written in Java. Mods are plagued with being out of date as Minecraft progresses, but the real popular ones with lots of support will stay up-to-date pretty well.

A plugin is code written to interact with a Minecraft server (or client, less often) via a well-defined API. The plugin is generally hosted by a mod that provides the API and proxies events, commands, etc.

Minecraft proper supports neither mods nor plugins directly. There is no official API or way to interface. But the scene is vibrant all the same. Various frameworks to support mods and plugins have sprung up. Some have died off but tutorials, books, forum posts, and so on still pollute Google and bookstores. As far as I can tell, the most important frameworks are as follows:

Forge provides a basic mod wrapper around decompiled Minecraft. If you use the Forge server (and launcher), you can choose the Forge mods to have enabled, and as a developer you have a bit more stable of an API.

Bukkit was the king of plugin frameworks, until it imploded in 2014 (due to a DMCA takedown by a bitter developer). CraftBukkit was the server mod that would host Bukkit plugins. It's probably possible to find the CraftBukkit jar still, but legality is grey at best.

After Bukkit imploded, the ground was fertile for dozens of replacement attempts. Now a little over a year later, it seems like there are two leaders. First, Spigot is a Bukkit-compatible API and has a server mod. It claims to also be a bit more performant than CraftBukkit, and I think it might have existed as a more-performant Bukkit since before Bukkit imploded. Since Spigot supports Bukkit plugins, and Bukkit was the most popular plugin API by a long shot, Spigot is now the most popular framework (the second is CraftBukkit, still.) You can see all this and more at the beautiful http://mcstats.org/

Sponge is taking a fresh (and purportedly improved) approach on the plugin API. It's not compatible with Bukkit. It's also not done, but it looks like it's probably functional. Legally, it's probably on much more stable ground than Spigot, however Spigot doesn't seem to be under any serious contestation so pragmatically speaking Spigot is probably the better choice unless you especially like the Sponge api or philosophy. Especially given the wealth of documentation, books, tutorials, etc. aimed at Bukkit which are mostly still relevant with Spigot.

Glowstone/Glowstone++ is a from-scratch server that supports the Bukkit API. It's meant to be faster, simpler, completely open source, but not 100% identical in behavior to vanilla Minecraft. It looks like a viable alternative to Spigot's server mod, but you don't have to decide up-front. You can write a Spigot plugin and use it on Spigot, Glowstone(++), or even old CraftBukkit.

So, the executive summary is it looks like you probably want to use Spigot, and you can use learning materials written for Bukkit. If down the road Spigot implodes and takes Glowstone with it (because of API copyright or something), then Sponge might be poised to be the successor. Or maybe once you've got some experience under your belt you'll find Sponge more attractive (and perhaps more complete, by then).

Hope that's helpful!