Shared: item object

An item object contains a handful of data to either compare with an incoming object or to create an outgoing object. The context of the values may change based on the feature using the item object, and some may not be available depending on that context.

1. "item"

The required "item" string specifies a base item ID. The following either looks for or creates the "minecraft:redstone" item.

"item_object": {
"item": "minecraft:redstone"
}

2. "data"

The optional "data" number specifies a metadata of the item. The following either looks for or creates a polished granite block.

"item_object": {
"item": "minecraft:stone",
"data": 2
}

When used in a key or ingredient, not specifying this tag or giving it a value of 32767 will indicate that the metadata value can be anything. When used in a result, it will set the item's metadata to the value specified, defaulting to 0 when not specified.

3. "count"

The optional "count" number specifies the number of items in the stack, defaulting to 1 when not specified. This cannot be used in a key or ingredient, only in a result. The following creates an item with a stacksize of 16.

"item_object": {
"item": "minecraft:stick",
"count": 16
}

Customizing recipes

Type

A recipe must have a type of crafting layout, specified in the "type" string. The value can either be "crafting_shaped" for shaped crafting or "crafting_shapeless" for shapeless crafting.

Groups

A recipe can optionally have a recipe group it belongs to within the crafting helper interface, specified by the "group" string. The value of this string can be anything. Any recipes that have the same group name specified will be shown together in the crafting helper. The intention is to keep similar items within the same category, such as all boats:

The following recipes belong to a group called "stuff" and will be grouped together in the crafting helper interface:

Shaped crafting

Shaped crafting involves placing items into the crafting window in a specific order. A pattern specifies the slots that items must appear in using arbitrary placeholder characters, while keys define what items those placeholders are looking for. Patterns and keys are both required with shaped recipes.

The following sets two placeholders in the pattern, being "#" and "^", while the keys define "#" as redstone dust and "^" as an iron block.

Patterns

A pattern must be specified via the "pattern" list. The list must contain between 1 and 3 strings, with each string representing a row in the crafting grid. Within each string there must be between 1 and 3 placeholder characters of your choosing, with each character representing a column. A space character indicates an empty slot in the crafting window, where no items are allowed to appear. The shape will automatically adapt to larger crafting grids, such that a 2x2 recipe will work in any corner of a 3x3 crafting grid.

For example, the following pattern uses only 1 row and all 3 columns, with an empty slot between the two items:

"pattern": [
"# #"
]

Which could look like any of the following in the crafting window:

All strings must contain the same number of characters. The following pattern is invalid due to the uneven rows.

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

The fix would be to specify an empty slot where the rows are uneven.

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

The fixed pattern could look like any of the following in the crafting window:

A pattern can have up to 9 unique placeholder characters. These characters can be anything (except the reserved space character), provided there is a corresponding key to go with them, although that doesn't mean that the items defined by those keys have to be unique. The following recipe makes use of 9 placeholders.

You can also use a single row and column to create a recipe where the item may be placed anywhere in the crafting grid, although you should use shapeless crafting instead as it is for unordered recipes.

"pattern": [
"#"
]

Which could look like the following in the crafting window:

Keys

A set of keys must be specified via the "key" object. This object contains multiple item objects, whose key names must be equal to the unique characters specified in the pattern. The key name can only be 1 character long and cannot be the reserved space character.

The following pattern set uses "H" and "?" as the placeholders, while the key defines what items those placeholders will be. The "H" represents a lever, while the "?" represents a bone.

If the "data" key is either not specified or has a value of 32767, the metadata value of the incoming item will be ignored. The following pattern set will accept stone, diamond swords, and wool of any kind.

Shapeless crafting

Shapeless crafting involves placing items anywhere into the crafting window in no particular order. A list of ingredients specifies the items that make up the recipe, which is required for shapeless recipes.

The following recipe will allow placing a diamond and a nether star anywhere in the crafting grid to receive a stick in return.

Ingredients

A set of required items must be specified via the "ingredients" list. This list contains item objects; if the player does not provide all items in this list, the recipe will not work. There is no limit to the number of items, though be aware that in vanilla there can only be 9 total items to provide in a crafting table.

The following will only work if the player provides all 5 items, which also means they cannot use the standard inventory crafting grid (2x2) to craft the item as there is not enough room.

Unlike in "key" and "ingredients" item objects, the "count" key may be specified in "result" to provide the player with multiple items. The following shapeless recipe will create 4 sticks when the recipe is fulfilled.

Commands

Command: /recipe

Coming soon...

Conclusion

Q&A

Q: Can custom recipes be used in 17w13b?

A: Not quite. The JAR must be modified directly, but in the future we will be able to modify recipes on a per-world basis, same as loot tables and advancements. This thread was created to prepare for that, so be aware that information in this thread is highly likely to become outdated once custom crafting becomes available without modding. Once it's possible, I will add instructions for file placement.

hello, thanks for the info, as of 17w14a i tried to place custom recipe in the save folder same way as loot_tables (data/recipes/minecraft/custom_recipe, i also tried without minecraft folder data/recipes/custom_recipe), but it's not showing in game, i assume it's still in development?

You can also use a single row and column to create a recipe where the item may be placed anywhere in the crafting grid, although you should use shapeless crafting instead as it is for unordered recipes.

How big is the impact in performance?

Because the Vanilla recipes for example for slime_ball.json is a "crafting_shaped"...

Is this mojang making a mistake or is there no difference in performance.

Because the Vanilla recipes for example for slime_ball.json is a "crafting_shaped"...

Is this mojang making a mistake or is there no difference in performance.

There's essentially no performance impact, it's more about being consistent with the concept. The vanilla recipes have some that have a single item in the recipe using shaped crafting, and others that do use shapeless as expected. Just be aware that the files are in their very early stages, and it could have been that shaped crafting was implemented before shapeless (and that the format could be completely different by the end of it all).

You don't, custom recipes have been postponed for 1.13. But considering the structure their use will most likely be the same as custom advancements and/or loot tables.

Thanxs for that - I assumed that with all the posts/guides talking about creating them, web page generators that help 'create custom recipes' & that the '/recipe' command exist ingame, I thought 1.12 actually had custom recipes.

Yups, that's exactly one of the reasons why I never use generators but instead rely on the JSON data provided by the Minecraft wiki. It might be a little hard at first, but once you grasp the official syntax and format can basically make anything you'd like. Including future new features because they'd all follow the same formatting.

Yups, that's exactly one of the reasons why I never use generators but instead rely on the JSON data provided by the Minecraft wiki. It might be a little hard at first, but once you grasp the official syntax and format can basically make anything you'd like. Including future new features because they'd all follow the same formatting.

I have to sort've disagree a little bit
- I've used some generators in the past which have helped show me the general format/layout of what a working example should look like (doing it from scratch I always seem to fail somewhere) but then I find generators sometimes have limitations - so knowing more of the 'backbones' of the code, explaining WHAT each bit suppose to do (like this post) - does help

What I do is use generators to get a basic layout made up - then go in & alter/add/change bits to suit what I actually want

Can you put multiple recipes in the same json? I'm trying to create some recipes for mod items

First of all: keep in mind that custom recipes aren't a thing yet. And as to your question: no. If they were then I'm sure Mojang wouldn't have made 400+ individual files. Of course, this will become conclusive once 1.13 comes out.

Hey, I try to modify the emerald_block.json recipe but it doesn't work and still the old one, so I try to make a new_block.json recipe but in game it doesn't work... I need forge to make it work? How I can fix it? thanks