User:PepijnMC/sandbox/Recipe

"The way it works in vanilla survival* is that you either "discover" a recipe by crafting it manually, or some other condition where we think "okay now you have sticks, we'll teach you how to make a pickaxe". After a recipe is "discovered" it's available in this recipe book, an optional thing you can click to in a crafting screen. From there you can see all the recipes you've discovered and how to craft them, so you don't need to google for the shape and ingredients. *I say vanilla survival because this is customizable. For example, a custom map could require you to only craft things they've given you, and nothing else. In vanilla survival this is purely a tool to help remember recipes you don't use much, or teach you about new ones that you may not have known about."

- Dinnerbone

Recipes are a way to gradually guide new players into Minecraft.

Obtaining
Recipes can be obtained in various ways. Using the recipe will automatically make the player discover it. Recipes can also be granted using the command or as a reward for completing an advancement. Vanilla survival has multiple advancements that grant recipes, which trigger when for example the player obtains an item required in the recipe.

Once a recipe has been discovered, it will be added to the player's recipe book. Discovered recipes are stored in the player's  NBT.

Usage
Recipes do not need to be discovered for the player to be able to use them, unless is set to.

JSON format
Custom recipes in the  folder of a data pack store the recipe data for that world as separate JSON files.

All recipe JSON files are structured according to the following format:


 * The root tag.
 * : The type of crafting recipe. Can be one of these 15 types.
 * : An identifier. Used to group multiple recipes together in the recipe book.
 * : A list of keys used to describe the 3x3 pattern for shaped crafting. Each row in the crafting grid is one string in this list containing 3 or less keys. All strings in this list need to have the same amount of keys. A space can be used to indicate an empty spot.
 * : All keys used for shaped crafting.
 * : The single character representing this item.
 * : The metadata of the item.
 * : An item ID.
 * : A data pack item tag.
 * : A list of ingredients used for shapeless crafting.
 * : The metadata of the item.
 * : An item ID.
 * : A data pack item tag.
 * : The output item of the recipe.
 * : The amount of the item.
 * : The metadata of the item.
 * : An item ID.
 * : An item ID.