Tutorial on foundations of the mod engine

Some of the long-time readers/users of the Sponge site will know my background. But I think over the 5+ years of sponge (has it been that long!!??) do not quite have the full story.

I’m 50. I’ve been a software engineer for 28 years. I primarily do embedded software in C/C++ and ARM assembly for the most part. But I was there (think scene when Elrond was flash-backing on the failure of Men to destroy the One Ring) back when Java was introduced. I was big into Java then, Java 1.0. I think I was doing Java as late as 1997 but I cannot remember for sure. I do remember being in some Seattle Java Users Group meeting when some grey-beards were talking about this new thing called Swing. Ah those were the days.

But the point is, I know software from the magic sand up to the button-click. If it is made out of silicon, has an instruction set, then I’ve probably written code for it, or like it.

Fast forward to 2011-12 when my son was old enough then to start playing Minecraft. Then all hell broke loose. Now I’m building servers, making mod-packs and causing all sorts of shenanigans. Let’s fast forward a bit more past my brief but very enjoyable Sponge days.

A lot of time past, some of it due to the nature of being older and having heart-issues, but I’ve recovered! I’m OK again.

Now I’m at the point where I have a bucket list. One of the items in my bucket list (pun not intended) is to understand exactly and with precise detail how Minecraft (the actual software, the .jar file) is torn apart, decompiled and analyzed so that the hook and byte-code rewrites allow for a Mod (like Sponge, not a plugin on top of Sponge) is actually hooked into the game so that events, and call-backs and etc… are invoked in the Mod.

I do owe myself some time spent with the debugger and a fresh copy of Forge to trace through the execution. But there’s a phase of development before that – the actual porting of code that slices into the Minecraft image the tweaks that allow the Forge stack to be called by Minecraft functions and in turn – make the whole modding process possible.

I’m looking for some advice on this - an expert - who has some clear understanding of the following:

  1. If I start with the basic, simple minecraft.jar, how I get from that to a Mod engine like Forge which exposes a new/transated API surface from which to develop Sponge-like core-mods.
  2. How on earth do the updates from minecraft.jar translate so quickly into a working Forge API stack on top of which core-mods like Sponge are possible.
  3. Does 1 or 2 require some secret information conveyed from Mojang (Grum, et.al.) to LM so he can fast-track the development of the next platform? Or is it literally a job of decompiling, and running tests to locate the obfuscated functions that are the linkage ripe for tweaking at the byte-code level?

I don’t look for advice for writing mods, or plugins, but the story before that – The Story between the raw official minecraft.jar up to and including the bare bones API surface that exists in something like Forge that Sponge relies on.

If you have the time, patience and ability to take dumb questions – let me know. I’d like to learn a great deal about this. It has been a long-time goal of mine to understand that part of the puzzle. The rest of the game – plugins, mods and so on are easier to grasp… It’s all API level programming. But the underlying parts are more subtle, I guess.

Contact me here directly or other means. I’m all over the place. But if that fails, just ping me at [email protected]

Thanks!

(ps: forward as necessary)

5 Likes