I’ve been running a Bukkit Minecraft server for my friends and I, and recently someone insisted we try out Tekkit instead. Tekkit is a combination of several mods like BuildCraft, IndustrialCraft, and some others, running on a Bukkit 1.1 server. Seeing as Minecraft had become pretty stale for me, all these mods were a welcomed extension. Especially considering they took out most of the grinding of the vanilla game (e.g. constantly having to manually chop wood), I’d come to love all the mods in the Tekkit pack.
However, one problem with the Tekkit pack is that it’s horribly outdated, and most of the mods are pretty buggy, even though most of those bugs have been fixed by newer versions. Being unhappy with this state, I set out to look for updated mods and stumbled upon a few problems:
- Most mods are incompatible with Bukkit.
- Most mods are specifically tailored for a specific version of minecraft.
- Most mods are not updated to the newest version of minecraft at all.
- Combine the two before, and you see that even though there’s a newer version of mod A, you’re still stuck with an old one because mod B forces you to use an older version of minecraft.
Luckily there is a team at mcportcentral that tries to port all the mods to Bukkit and thus solves most of my problems, but the whole infrastructure of mods is pretty horrible 🙁
The compatibility problem: Obfuscation
From what I’ve gathered this far, the main problem is Minecraft’s obfuscation, and the fact that different teams are using different deobfuscation keys.
The version bit comes down to the fact that each version of minecraft is obfuscated differently, and as such the HelloWorld class might’ve been called a in version 0.1, but is now called b in version 0.2. If a mod depended on the HelloWorld class, and as such was compiled against the a class in v0.1, it will fail on v0.2 because that class is now called b. Even if nothing actually changed in the HelloWorld class, and even though the mod should remain mostly compatible, the obfuscation breaks everything.
The problem gets even worse when there are different deobfuscation keys being used. For example, let’s look at Minecraft Coder Pack (MCP) and CraftBukkit. The first will decompile and deobfuscate a Minecraft jar file, and spit out the source code and possibly a deobfuscated jar file. CraftBukkit is an already decompiled and deobfuscated version of the server, with some extra changes to allow for the Bukkit API. Both are, however, using a different deobfuscation key. So let’s say we have the HelloWorld class again. MCP could deobfuscate this to OhHaiWorld, whereas CraftBukkit might have deobfuscated it as WelcomeWorld.
So let’s say that instead of writing my mod for the vanilla minecraft server, I pick a deobfuscated one because it will allow me to keep it easily updated. (Note: this is what most modders do, but they re-obfuscate it with release so it’s easier to apply for normal users).Even though it’ll now probably work on Minecraft 1.2.1, 1.2.3, and 1.2.5 (provided the user deobfuscates first), it will still not work on both CraftBukkit and the Vanilla server.
Combination problem: Overwriting files
Another problem in the actual modding is that often you need to intercept parts of Minecraft, or change bits of it. Usually this is done by simply changing some of the Minecraft classes. The problem is that you can’t combine two mods that modify the same class, and if you’re using a different brand of server (e.g. CraftBukkit) that already had several changes in that class you can’t use a mod that modifies it too as it will undo the changes in that specific brand server.
Luckily, there are a few solutions available, although most include a shitload of manual work too.
For example to manually port a mod from 1.2.3 to 1.2.5, you could get the MCP for 1.2.3, deobfuscate the mod, then get the MCP for 1.2.5 and reobfuscate it. If it doesn’t actually overwrite any of Minecraft’s files (e.g. it’s using something like Forge or ModLoader(MP) to do the actual hooks in minecraft’s code), this should be enough. If it does overwrite files, you should compare the (decompiled and deobfuscated) changes from the vanilla 1.2.3 server, and reapply those changes in the 1.2.5 server manually.
Porting a mod from vanilla to CraftBukkit usually involves more work. Maeyanie luckily keeps a list of name changes from MCPs deobfuscation key to Bukkit’s deobfuscation key which you can use to automate a part of the work. However, as CraftBukkit usually entails a lot of changes from the vanilla server, you still need to manually sift through any changes to Minecraft’s code. If the mod only adds files and uses Forge or something, that won’t be a lot of work, however if you’re porting Forge itself, you’re up for a lot of manual comparing and coding.
I’m hoping to get more involved in the minecraft, and mostly CraftBukkit and Forge, mod scene at some point. I’ve got several ideas to try to automate more of the porting process, even though I’m not sure if I have the time to implement them all. Feel free to keep track of this blog for any future work on this.
Also, if there’s anything unclear, plainly wrong, or confusing, do feel free to use the comment field or contact me through other means 🙂