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.
The required "item" string specifies a base item ID. The following either looks for or creates the "minecraft:redstone" item.
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.
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 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:
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:
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:
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.
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).
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