User Tools

Site Tools


Sidebar

← Go back to the homepage

Fabric Tutorials

Setup

Basics

These pages are essential must-reads when modding with Fabric, and modding Minecraft in general, if you are new to modding, it is recommended you read the following.

Items

Blocks and Block Entities

Data Generation

World Generation

Commands

These pages will guide you through Mojang's Brigadier library which allows you to create commands with complex arguments and actions.

Events

These pages will guide you through using the many events included in Fabric API, and how to create your own events for you or other mods to use.

Entities

Fluids

Mixins & ASM

These pages will guide you through the usage of SpongePowered's Mixin library, which is a highly complex topic. We recommend you read these pages thoroughly.

Miscellaneous

Yarn

Contribute to Fabric

tutorial:recipes

Crafting recipes

Adding a basic crafting recipe

Make sure you added an item before reading this tutorial, we will be using it.

So far, our item is obtainable through the creative menu or commands. To make it available to survival players, we'll add a crafting recipe for the item.

Create a file named custom_item.json under resources/data/tutorial/recipes/ (replace tutorial with your mod id if appropriate).
Recipe files are conventionally named after their output, but they can have any name. Here's an example recipe for the custom_item we made:

resources/data/tutorial/recipes/custom_item.json
{
  "type": "minecraft:crafting_shaped",
  "pattern": [
    "WWW",
    "WR ",
    "WWW"
  ],
  "key": {
    "W": {
      "tag": "minecraft:logs"
    },
    "R": {
      "item": "minecraft:redstone"
    }
  },
  "result": {
    "item": "tutorial:custom_item",
    "count": 4
  }
}

Breakdown of the recipe:

  • type: This is a shaped crafting recipe.
  • result: This is a crafting recipe for 4 tutorial:custom_item. The count field is optional. If you don't specify a count, it will default to 1.
  • pattern: A pattern that represents the crafting recipe. Each letter represents one item. An empty space means that no item is required in that slot. What each letter represents is defined in key.
  • key: What each letter in the pattern represents. W represents any item with the minecraft:logs tag (all logs). R represent the redstone item specificly. For more information about tags see here

In total, the crafting recipe would look like this:

Recipe for 4 custom_item
Any LogAny LogAny Log
Any LogRedstoneNothing
Any LogAny LogAny Log

For more information about the format of basic recipes, see here.

Recipes can also be generated dynamically on runtime, for more information see here.

More on the recipe type

The type value can be changed so it can be used in the corresponding crafting block (stone cutter, blast furnace, smiting table, …), see all types and values here.

You can even create your own recipe type: Introduction to RecipeTypes

tutorial/recipes.txt · Last modified: 2022/07/23 20:42 (external edit)