As of 1.12, recipes have become data-driven via external JSON files. This allows map makers, modders, and server owners to modify and add recipes to their liking.
Recipes can be shaped or shapeless, producing a specific item. As of 17w13b, only crafting table recipes are customizable. A new command, /recipe, has been introduced to supplement the files.
Recipes use the JSON format to store the recipe in external files.
JSON Structure
The following is a list of all possible keys for recipes.
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.
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.
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.
The following recipe makes use of shaped crafting.
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 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.
Image example of how it is used in the crafting window:
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.
"pattern": [
"!@#",
"$%^",
"&*("
]
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.
Which would look like the following in the crafting window:
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 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.
Image example of how it is used in the crafting window:
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.
Which could look like the following in the crafting window:
You can also require just a single item, and that item can be placed anywhere in the crafting window.
"ingredients": [
{
"item": "minecraft:torch"
}
]
Which could look like the following in the crafting window:
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 will accept stone, diamond swords, and wool of any kind.
A recipe must have the resulting item that is crafted, specified in the "result"item object. Unlike in "key" and "ingredients" item objects, the "data" key will default to 0 when not specified.
For example, if the following shaped recipe is fulfilled, the player will receive a new anvil.
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.
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?
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).
I believe I spotted a needed correction though: there appears to be a duplicated section regarding the diamond swords and data tag within the shapeless crafting category.
Definitely gonna follow this thread, can't wait to see what they do with this. I'm really eager to get NBT integration for this, it'd make custom maps even more amazing.
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.
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
The Meaning of Life, the Universe, and Everything.
Join Date:
9/14/2016
Posts:
57
Member Details
Does the upcoming json recipes in 1.13 only support crafting table recipes or will we also be able to change furnace recipes, anvil recipes and brewing stand recipes?
Index
Generic info
1. Intro
2. JSON structure
3. Shared: item object
Customizing recipes
4. Type
5. Groups
6. Shaped crafting
7. Shapeless crafting
8. Results
Commands
9. Command: /recipe
Conclusion
10. Q&A
11. External links
12. Conclusion
Generic info
Intro
As of 1.12, recipes have become data-driven via external JSON files. This allows map makers, modders, and server owners to modify and add recipes to their liking.
Recipes can be shaped or shapeless, producing a specific item. As of 17w13b, only crafting table recipes are customizable. A new command, /recipe, has been introduced to supplement the files.
Recipes use the JSON format to store the recipe in external files.
JSON Structure
The following is a list of all possible keys for recipes.
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.
2. "data"
The optional "data" number specifies a metadata of the item. The following either looks for or creates a polished granite block.
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.
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.
The following recipe makes use of shaped crafting.
While the following recipe makes use of 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.
Image example of how it is used in the crafting window:
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:
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.
The fix would be to specify an empty slot where the rows are uneven.
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.
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.
Which would look like the following in the crafting window:
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.
Which could look like the following in the crafting window:
To work around that, you would specify the metadata value. The following pattern set ensures that the incoming diamond swords are brand new.
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.
Image example of how it is used in the crafting window:
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.
Which could look like the following in the crafting window, plus many more combinations:
You can use the same item multiple times, in which the player must provide all instances of that item.
Which could look like the following in the crafting window:
You can also require just a single item, and that item can be placed anywhere in the crafting window.
Which could look like the following in the crafting window:
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 will accept stone, diamond swords, and wool of any kind.
Which could look like the following in the crafting window:
To work around that, you would specify the metadata value. The following ensures that the incoming diamond swords are brand new.
Results
A recipe must have the resulting item that is crafted, specified in the "result" item object. Unlike in "key" and "ingredients" item objects, the "data" key will default to 0 when not specified.
For example, if the following shaped recipe is fulfilled, the player will receive a new anvil.
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.
External links
- Generic JSON Validator
Conclusion
If there is information that needs to be added, corrected, or clarified, please post!
Minecraft-things: http://skylinerw.com
More Minecraft-things: https://sourceblock.net
Guides for command-related features (eventually moving to Source Block): https://github.com/skylinerw/guides
I primarily hang out in the /r/MinecraftCommands discord, where there's a lot of people that help with commands: https://discord.gg/QAFXFtZ
Their corresponding subreddit: https://www.reddit.com/r/MinecraftCommands/
Is there not a way to use an item with nbt?
Currently no, but custom recipes are in the very early stages so we'll probably see a lot more customization in the future.
Minecraft-things: http://skylinerw.com
More Minecraft-things: https://sourceblock.net
Guides for command-related features (eventually moving to Source Block): https://github.com/skylinerw/guides
I primarily hang out in the /r/MinecraftCommands discord, where there's a lot of people that help with commands: https://discord.gg/QAFXFtZ
Their corresponding subreddit: https://www.reddit.com/r/MinecraftCommands/
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?
Recipes are not a priority for mojang right now, so don't expect it to be implemented without a tweet/reddit post/whatever stating otherwise.
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).
Minecraft-things: http://skylinerw.com
More Minecraft-things: https://sourceblock.net
Guides for command-related features (eventually moving to Source Block): https://github.com/skylinerw/guides
I primarily hang out in the /r/MinecraftCommands discord, where there's a lot of people that help with commands: https://discord.gg/QAFXFtZ
Their corresponding subreddit: https://www.reddit.com/r/MinecraftCommands/
This is strikingly similar to the way Forge registers recipes. I mean, it's like the method call was translated into a json structure.
Putting the CENDENT back in transcendent!
That's not "the way forge registers recipes", that was always in the game code written by mojang.
17w16a has introduced a new groups feature, specifically used for the crafting helper interface to group items together.
Minecraft-things: http://skylinerw.com
More Minecraft-things: https://sourceblock.net
Guides for command-related features (eventually moving to Source Block): https://github.com/skylinerw/guides
I primarily hang out in the /r/MinecraftCommands discord, where there's a lot of people that help with commands: https://discord.gg/QAFXFtZ
Their corresponding subreddit: https://www.reddit.com/r/MinecraftCommands/
Wow, this is another guide that is very helpful.
I believe I spotted a needed correction though: there appears to be a duplicated section regarding the diamond swords and data tag within the shapeless crafting category.
Definitely gonna follow this thread, can't wait to see what they do with this. I'm really eager to get NBT integration for this, it'd make custom maps even more amazing.
If anybody needs me to make a custom crafting recipe and put it into their minecraft 1.12 jar, I willEDIT: I made a new thread for this
I know it's an old thread, but have a some questions now that 1.12 is finally out - any further info to add about custom recipes ?
For example...
> HOW do we actually add the json file into the game - is it similar to custom advancement? .. if so - which folder does it have to go into?
> As soon as you load a map - does every player have access to all the custom recipes or do you have to 'give' access to them somehow
- if so, how is it done ??
> The 'results' - can these have enchantments added or names/lores added etc
I'm sure someone could come up with other questions
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.
Guess I have to wait
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
"rumured" it's actually a confirmed change.
Does the upcoming json recipes in 1.13 only support crafting table recipes or will we also be able to change furnace recipes, anvil recipes and brewing stand recipes?
so far only crafting, furnace recipes have been confirmed, but not specifically for 1.13.
how can i give the result a enchantment?
>> https://minecraft.curseforge.com/members/XxRexRaptorxX/projects
not possible (yet). remember that the format is not complete and cannot be used yet. (1.13 will change the format due to the flattening)