Forge Modding Tutorials 1.8: Shapeless & Smelting Recipes

In this tutorial I will show you how to add shapeless recipes and smelting recipes to your mod. This is the modfile I will start with.

Adding a shapeless recipe is very similar to adding a normal recipe. A shapeless recipe is shown below.

Instead of using the addRecipe method in GameRegistry you use addShapelessRecipe. In this method, the first parameter is again the output. The second parameter is also the same as the addRecipe method which can take as many objects as you want. This also works exactly the same way as in the old method. The only difference between a normal recipe and a shapeless recipe is that the shapeless recipe, as the name suggests, is shapeless. This means the input items can be put in in any way you want and they will create the item. This is very useful in situations like crafting dyed wool from wool and a dye.

 

Smelting recipes are similar to crafting recipes but they are for furnaces. A smelting recipe will look similar to this.

The first parameter can either be an Item, Block or Itemstack and is the input of the recipe. The input will always have to be stack size 1. The second parameter is the output of the recipe. This parameter always has to be an ItemStack, but this can have a stack size of more than one as displayed above. The final parameter is the amount of experience a player gets from smelting this recipe in a float. For vanilla recipes this ranges from 0.1 for cobblestone to 1 for emeralds and diamonds.  It is possible to make it higher than 1F though.

With these 2 new recipes the mod class will now look like this.

In the next tutorial I will show you how to put all of this code in a separate class, because with this, the mod class can get filled up far too much really quickly.

 

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="">