This is the twelfth lesson in a series introducing 10-year-olds to programming through Minecraft. Learn more here.

Unlike the resource mods we created earlier (text, images), our Something For Nothing mod only works when we run Minecraft through our workspace in Eclipse. What if we want to share it with our friends or upload it so others can try it out?

Prerequisites

We need to update our "real" copy of Minecraft with Forge so we can verify our mod works before distributing it. This only needs to happen once, but unfortunately when you update your version of Minecraft, you're going to have to also re-download the matching src that we did in the previous step as well as the installer mentioned below.

Visit http://files.minecraftforge.net and download the installer that matches the version you're using (we've been using 9.10.0.804). You will get a file named something like minecraftforge-installer-1.6.2-9.10.0.804.jar.

After the file downloads, double-click to run it. Verify the defaults (Install client chosen, proper directory name) and press OK.

Launch Minecraft and switch to the new profile called 'Forge'; let it copy your current username/password. Press 'Play' to satisfy yourself that it's actually working and then quit the game and launcher.

Create Your Mod Archive

  • Open Windows Explorer, navigate to your workspace directory (e.g. c:\eclipse-workspace) and then continue to forge\mcp.
  • Double-click on recompile.bat. (Don't worry if you get an error message saying "Can not find server sources")
  • Double-click on reobfuscate.bat. (Again, ignore any server-related error messages. Also ignore Windows Defender.)

You should recognize your classes in the output. For instance, I tried this after writing the "Something for Nothing" mod and got the following output

> Extracting modified classes
> New class found      : mc/jb/first/SomethingForNothing
> New class found      : mc/jb/first/ConnectionHandler
> New class found      : mc/jb/first/client/ClientProxy
> New class found      : mc/jb/first/CommonProxy

Note that the reobfuscate commands also tells you that the output has gone to the reobf subdirectory.

> Outputted mc/jb/first/SomethingForNothing     
    to reobf\minecraft 
            as mc/jb/first/SomethingForNothing.class
  • Navigate down two more directories (reobf\minecraft).
  • Select all the files/directories and ZIP them.

Try Out Your Mod

  • Copy the zip file we just created to to %appdata%\.minecraft\mods (You might have to create the mods directory if it doesn't exist)

  • Run Minecraft :)