Modding Minecraft with Forge

Lesson 5 of 6

Adding a Crafting Recipe

Forge recipes are plain JSON data, no Java required, living under data/<modid>/recipes/.

A shaped recipe

src/main/resources/data/examplemod/recipes/ruby_block.json:

{
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "RRR",
    "RRR",
    "RRR"
  ],
  "key": {
    "R": { "item": "examplemod:ruby" }
  },
  "result": {
    "item": "examplemod:ruby_block",
    "count": 1
  }
}

pattern is a 3x3 (or smaller) grid where each character maps to an ingredient in key, blank rows/columns are allowed for recipes smaller than a full crafting grid. The type tells the game which recipe serializer to use, minecraft:crafting_shaped respects the exact layout, while minecraft:crafting_shapeless (no pattern/key, just an ingredients array) ignores placement entirely.

Recipe advancements

Recipes only show up in a player's recipe book once they've been "unlocked", normally the moment they first obtain one of the ingredients. That unlock condition lives in a matching advancement file, data/examplemod/advancements/recipes/.../ruby_block.json, with a minecraft:recipe_unlocked trigger, generated projects and mod-dev tooling can scaffold this for you, but it's worth understanding it's a separate file from the recipe itself.

Testing it

Rebuild and relaunch with ./gradlew runClient, resource and data files under src/main/resources are picked up automatically, open your inventory's crafting grid in-game and confirm the recipe actually works.

📝 Crafting Recipes Quiz

Passing score: 70%
  1. 1.Where do Forge crafting recipes live?

  2. 2.A recipe that ignores item placement in the crafting grid uses the type minecraft:crafting_____.

  3. 3.A recipe automatically appears in a player's recipe book with no additional configuration.