minecraft modding – integrated nei

NB: The following only applies to Minecraft 1.4, the process is a lot simpler in MC1.6+

This is a bit of a non sequitur from my normal content, but truth be told, I’ve just never had a chance to talk about anything Minecraft-related on here yet 😛

One of my least favorite parts of Minecraft modding is the testing and iteration process. If you use MCP’s Eclipse project, rudimentary iteration is simple. You can rebuild and launch a client or server directly from the IDE without having to reobfuscate the code first. This is great for tracking down bugs like forgetting to actually register your blocks and simple stuff like that.

It’s not so great for testing something that requires survival mode mechanics plus arbitrary items that aren’t simply going to worldgen right next to you (ie, almost every real test case).

Case in point, we wanted to test carrots. By making a creative mode world, I was able to spawn a carrot and confirm that I could craft seeds out of it. I was even able to confirm planting the seed and that it grew over time… but I couldn’t test breaking the block to harvest or that the seeds were being consumed on planting…

Normally, I’d use something like NEI for this. But NEI is one of those tricky mods that requires installation in the jarfile. Also, running the game from Eclipse renders it incompatible with obfuscated mods (ie, any distributed mod). After a lot of trial and error and 3 corrupted MCP installs, I finally stopped being stupid and realized that ChickenBones has released his sourcecode (no need to fail miserably at deobfuscating it).

Original source in hand, it was only a few minutes and we had glorious useful NEI for testing. Assuming you have already set up MCP+Forge with Eclipse, the install process goes something like this:

  1. Download source for CCC and NEI (from the thread here).
  2. Decompress somewhere useful.
  3. Link both common and client folders to your project’s build path.
  4. DELETE GuiContainer from MCP’s client src.
  5. Profit.

I put both CCC and NEI in an external/ folder and just copied their common and client source into a single sub-directory for simplicity, but it may be better to leave them separate – especially when working with server code as well.

GuiContainer appears to be the only base class that NEI overrides, so simply ensuring that his version is in the classpath while the vanilla version is not is enough to get things to compile and run.

Leave a Reply

Your email address will not be published. Required fields are marked *