Forge Modding Tutorials 1.8: ModRecipes

In the previous two tutorials you will have noticed that the mod file will increase in size very quickly if you put all of your recipes in there. This isn’t a problem when you’ve only got a few recipes, but when you need more than 10 this could become a problem. The class I will be cleaning up is shown below.

What you will have to do is right click the package in which this mod is made. In my case this is com.wuppy.tutorial. Now, select New and Class. As the class name, put in ModRecipes. Doing this will get you a class looking similar to this one.

In here create a public static void addRecipes. Next, select all of the recipe code in the mod and cut & paste them in there. If you really have a lot of recipes you may want to split up addRecipes in several sub methods which all register their own types or groups of recipes, but for the tutorial mod this isn’t required. The ModRecipes class will now look as follows.

This code doesn’t run now though. In Tutorial you will have to call the addRecipes method which can simply be done by adding ModRecipes.addRecipes() in the init method. The resulting mod file is this.

This simple action greatly clears up the mod file and clear code ensures it’s easier to mod. This same strategy can, and will, be used to create items and blocks in separate classes to keep everything clear and easy to read.


For a more detailed explanation and much more, check out my book Sams Teach Yourself Mod Development for Minecraft in 24 Hours.

STY Minecraft Mod Development Book


Or donate if you enjoyed this tutorial.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">