Adding Custom Recipes to Minecraft

Adding your own custom recipes to Minecraft is once again a fairly easy feat. It simply requires us to make another JSON file and that’s what we’re gonna do next!

The JSON file for custom recipes

Firstly, the JSON file is located in the recipes folder under data > tutorialmod > recipes which we have already created in the Folder Structure Setup. It’s also important to note that the recipes do not have to have a specific name. Although it is recommended that they are called after the result with an added suffix _from_smelting or similar if they are from something other than the crafting grid.

The contents of the files are actually fairly easy to understand. I’ll show you the vanilla recipe for the iron pickaxe, so you get a good idea:

Format of the JSON file

{
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "XXX",
    " # ",
    " # "
  ],
  "key": {
    "#": {
      "item": "minecraft:stick"
    },
    "X": {
      "item": "minecraft:iron_ingot"
    }
  },
  "result": {
    "item": "minecraft:iron_pickaxe"
  }
}

As you can see the way a recipe is structured is actually fairly readable. Inside the pattern you can see three string which represent the crafting table. Their length doesn’t have to be three! And there also don’t have to be three string. A boat for example has the following pattern:

  "pattern": [
    "# #",
    "###"
  ]

You can craft the boat either with three planks at the bottom or in the middle. Therefore, the system leaves a lot of flexibility. The type can have a few different values as well – even custom recipe types are possible! But for now crafting_shaped and crafting_shapeless are the ones we’ll take a look at.

At the end of the article we’ll also quickly look at smelting and blasting. For a good overview please take a look at the Minecraft fandom wiki article on recipes.

The characters inside the pattern are represented by a key which references an item. There once again you need to specify a ResourceLocation. So your ModId or “minecraft” if it is a vanilla item followed by colon and then the name of the item; the one you define in your ModItems class.

As you might have guessed, the result is whatever the crafting result is supposed to be. You can also give a count like this:

  "result": {
    "item": "minecraft:jungle_planks",
    "count": 4
  }

Shapeless Recipes

When it comes to shapeless recipes, they actually define only an ingredient instead of a pattern and keys. Like in the example here to make jungle planks:

{
  "type": "minecraft:crafting_shapeless",
  "group": "planks",
  "ingredients": [
    {
      "tag": "minecraft:jungle_logs"
    }
  ],
  "result": {
    "item": "minecraft:jungle_planks",
    "count": 4
  }
}

Making our own recipes

Now that we know almost everything about how the recipes work, we are finally create our own recipe. I want to be able to craft the amethyst ore we made in the block tutorial. You can craft it by making a making an x with the amethysts and filling the rest in with stone.

Let’s create a new file under data > tutorialmod > recipes called amethyst_ore.json:

{
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "#S#",
    "S#S",
    "#S#"
  ],
  "key": {
    "#": {
      "item": "tutorialmod:amethyst"
    },
    "S": {
      "item": "minecraft:stone"
    }
  },
  "result": {
    "item": "tutorialmod:amethyst_ore"
  }
}

Here’s the first recipe needed to make this a reality. Easy enough, so let’s see if our custom recipe has been added to the game.

Custom Recipes in Game

Crafting amethyst ore in Minecraft 1.16.5
Successfully crafting Amethyst Ore

That is pretty much everything you need to do, in order to add some new custom recipes to Minecraft.

Smelting and Blasting recipes

Just so that we have it covered, here are two examples for smelting and blasting recipes. You could for example add another recipe where you get amethyst from smelting the amethyst ore.

Smelting Recipe Example

{
  "type": "minecraft:smelting",
  "ingredient": {
    "item": "minecraft:lapis_ore"
  },
  "result": "minecraft:lapis_lazuli",
  "experience": 0.2,
  "cookingtime": 200
}

Blasting Recipe Example

{
  "type": "minecraft:blasting",
  "ingredient": {
    "item": "minecraft:iron_ore"
  },
  "result": "minecraft:iron_ingot",
  "experience": 0.7,
  "cookingtime": 100
}

Both of them are fairly easy to add. The convention is to name the JSON files result_from_smelting.

Vanilla JSON Files

You can actually find all the vanilla recipe files under the following directory. Inside your project window navigate down to External Libraries and then:

Showing the location of minecraft vanilla json files.
Location of vanilla JSON files.

Common Mistakes and Errors

My custom recipes don’t work!

Firstly, double-check that your JSON files are in the correct folder. They must located under data > YOUR MOD_ID > recipes. Make sure it is recipes not recipe and see if there’s a typo in the directory or folder names.

Secondly, the contents of JSON file might have some typo or misspelling. Make sure that the names and your mod id are written correctly. Make sure that you have changed the mod id if you copied the file!

The formatting of the JSON file is also important. You should see a red underline inside the JSON file, if there is an error with the formatting. Alternatively you can also take a look at an online JSON validator. I linked the one I personally use most often.

Challenge for you

I have also included an amethyst block texture in the assets for you. You can make a new block and add custom recipes to it, if you want to try it out. Check out the article on making a block, if you need a refresher. The textures and files you would need are also available for download at the bottom of the article.

Summary

In summary, adding custom recipes to Minecraft should not pose a big challenge. Sometimes, it can be overwhelming if you want to add a lot of recipes and even though that can involve a lot of copying-and-pasting it’s still really cool to finally see your custom recipes in Minecraft.

If you have any more question don’t hesitate to ask and also check out the video version of this article!

Downloading the Assets

GitHub Repo: https://github.com/Tutorials-By-Kaupenjoe/Minecraft-1.16.5/tree/6-customRecipes
Amethyst Ore Recipe as Gist: https://url.kaupenjoe.net/yt12/gist1
Amethyst Block Files (Solutions) as Gist: https://url.kaupenjoe.net/yt12/gist2
Amethyst Block PNG: https://url.kaupenjoe.net/yt12/textures
Assets zipped: https://url.kaupenjoe.net/yt12/assets

Was this helpful?

8 / 2

Leave a Reply 0

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