How to make a crafting recipe in a Minecraft mod
A recipe is data: a JSON file in your mod’s data/<modid>/recipe folder (data/<modid>/recipes before 1.21, assets/<modid>/recipes on 1.12.2) that the game loads with the world. A shaped recipe has a pattern of up to three rows and a key that says which item each symbol is.
Works on Minecraft 1.20.1 to 26.3 on NeoForge; Minecraft 1.16.5 to 26.3 on Fabric; Minecraft 1.16.5 to 1.20.1 on Forge; Minecraft 1.12.2 on Forge. Each example was compiled against its loader and version before it shipped in Linen.
- Make a JSON file in your mod’s recipe folder named after the recipe.
- Set its type to minecraft:crafting_shaped.
- Write the pattern rows and the key for each symbol.
- Set the result item and count.
- Load a world and check the crafting table (/reload picks up changes on 1.13 and newer).
What you can change
Section titled “What you can change”The example uses these values. Change them in the code.
| Setting | In the example | What it does |
|---|---|---|
| ingredient | minecraft:cobblestone |
The item the 2x2 pattern is made of (an item id, or #a tag). |
| result | minecraft:mossy_cobblestone |
The item it makes. |
| count | 4 |
How many it makes. |
For each loader and version
Section titled “For each loader and version”The example mod is examplemod in the package com.example.examplemod. Use your own mod id and package.
Fabric 1.16.5 to 26.3, NeoForge 1.20.1 to 26.3, Forge 1.16.5 to 1.20.1
Section titled “Fabric 1.16.5 to 26.3, NeoForge 1.20.1 to 26.3, Forge 1.16.5 to 1.20.1”Uses:
minecraft:crafting_shaped
Forge 1.12.2
Section titled “Forge 1.12.2”Uses:
minecraft:crafting_shaped
In 1.12.2 a recipe is a file in assets/<modid>/recipes; the ingredient and the result are written as {“item”: “modid:name”}.
Sources
Section titled “Sources”Related how-tos
Section titled “Related how-tos”In Linen
Section titled “In Linen”Linen’s How-tos library has this page too, with the example for your own mod’s loader and Minecraft version. Hover a name in your code and Linen points to the how-tos that explain it. Both are free. Download Linen.