Tutorial 7. Recipes

Before you read, make sure you have seen the previous tutorial

Code is on github

Small tutorial today, on how to add crafting recipes.
There are 3 recipes, but ill show you how to maniputlate a stack aswell.

First, a little setup:

So, we create a new class CraftingHandler, in core.handler, where we create a new method init, to load everything.

Now, lets add the recipes

1) Shaped Recipe:

A shaped recipe, where your crafting grid contains one testBlock in the middle, and is surrounded with dirt. That recipe will output 2 testItems. Pretty straight forward.

2) Shapeless Recipe:

At random places in your crafting grid, need to be 2 blocks of dirt, one block of grass, and one testBlock. If that is true, then your output is 4 testItems.

3) Smelting Recipe:

The name of the method is weird. That has to do with the way minecraft is translated. For now, just use that. Later, the name will change in something more fancy.
So, if you put one testItem in the top slot of a funace, you will receive one testBlock, and 1f experience. Easy.

For blocks, change the func_151396_a.
So it will be:


Last thing what i wanna show, is manipulation.

In here, make a new itemStack called manipulation, that contains a diamond sword. We add the Enchantment efficiency to  the manipulation. So now manipulation has 1 dia sword with Efficiency. We create a shapeless recipe, with as output manipulation, and as input one block of dirt.

Really small tutorial on how to add recipes.

Back to List
Next tutorial

Final file:


4 Responses to Tutorial 7. Recipes

  1. Trunks9809 says:

    Just a thought, you may want to note under the smelting recipes that if your input is a block you need to use GameRegistry.addSmelting() – func_151396_a only accepts an item input.

  2. 1arthurf says:

    I found it useful and better looking if you loaded your recipes in to be registered rather than added the in the init().
    <code class="public class Crafting_Handler

    public static void init()


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=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">