Packaging Your Mod

Before you can share your mod you will need to properly package it, so that Forge will be able to load it.  The first thing you need to do is to install Forge, using the Forge installer, into your local Minecraft.  You can download the installer from http://www.minecraftforge.net/.  The installation process is straight forward.  Once it has completed, it will create a Forge profile, which is the profile you will use to play your mod in-game. 

Once Forge has been installed, you will need to generate a distributable archive for your mod.  The archive, generally a Zip file, will contain the compiled Java classes and the textures that are to be displayed.  However, before you can generate the archive, you need to run two commands, which will be found in the mcp directory:

  • recompile – this recompiles the Java source code (.java files) into compiled byte code (.class files), there will be some errors when this command runs, as long as there are no error with any of the classes that you created, then you can ignore the errors
  • decompile – may need to execute this command if the recompile asks you to do so, otherwise it will not be needed, of course you would then need to do the recompile again
  • reobfuscate – this recreate the Minecraft jar files and will copy your custom classes, you only need to worry about the Minecraft jars if you did jar hacks, which is not recommended

Note: There may be some errors displayed when executing these commands.  In general, errors are expected and you should be able to proceed.  

After these commands have completed, you will then be able to find the compiled Java class files in the directory mcp/reobf/minecraft directory.  It is from here that you will want to create your Zip file.  Although MCP does a great job by doing most of the work for you, it does not include the texture files.  You will need to manually copy the texture files from the mcp/src/minecraft/assets directory to the mcp/reobf/minecraft.  Make sure to copy only the textures that you created.  Avoid including the forge directory with mod, it could result in unexpected behavior.  In addition, sometimes it will put additional .class files, which you will need to delete.  You want to only include .class files for the ones you created for your Mod.  

Once the textures have been copied over to the reobf directory, then you will be ready to create your Zip file.  Simply make a new Zip file, named after your mod, and include everything under the minecraft directory, which would be the reddiamond and assets directories.  You have just created a distributable Minecraft Mod. 

To test your mod, you should first install it in your local instance by simply dropping the Zip file into the %appdata%/.minecraft/mods directory and restarting Minecraft in single player mode.