Skip to content

Instantly share code, notes, and snippets.

@ZebulanStanphill
Last active March 25, 2017 01:44
Show Gist options
  • Save ZebulanStanphill/a546ab25ec09a435e5a1b55d15ea720e to your computer and use it in GitHub Desktop.
Save ZebulanStanphill/a546ab25ec09a435e5a1b55d15ea720e to your computer and use it in GitHub Desktop.
Suggested WIP crafting format revision
{
"type": "crafting", //Recipe type
"ingredients": [
{ //An item group that can be moved seperately from other groups
"pattern": [
"AA",
"AB",
" B"
],
"fixed": "BOOLEAN, optional (default: false): if this item group cannot be moved in the recipe (if fixed, the placement of the item group is always at the top left corner of the crafting grid)",
"can_flip_horizontally": "BOOLEAN, optional (default: false): if this item group can be flipped horizontally in the recipe",
"can_flip_vertically": "BOOLEAN, optional (default: false): if this item group can be flipped upside down in the recipe"
}
],
"modifier_ingredients": [ //Special, sometimes optional ingredient groups - example: dyes in dyed leather armor recipes
{ //An item group that can be moved seperately from other groups
"pattern": [
" ",
" ",
"B "
],
"fixed": "BOOLEAN, optional (default: false): if this item group cannot be moved in the recipe (if fixed, the placement of the item group is always at the top left corner of the crafting grid)",
"can_flip_horizontally": "BOOLEAN, optional (default: false): if this item group can be flipped horizontally in the recipe",
"can_flip_vertically": "BOOLEAN, optional (default: false): if this item group can be flipped upside down in the recipe",
"min_groups": "INTEGER, optional (default: 1): the minimum amount of this item group that can be used in the recipe",
"max_groups": "INTEGER, optional (default: -1 (unlimited)): the maximum amount of this item group that can be used in the recipe"
}
],
"modifier_ingredients_required": { //Optional, if absent, no modifier ingredients are required, except
"min": "INTEGER: the minimum amount of optional ingredient groups that can be used in the recipe",
"max": "INTEGER: the maximum amount of optional ingredient groups that can be used in the recipe (-1 = unlimited)"
},
"key": {
"A": {
"item": "STRING: The item ID",
"data": "INTEGER, optional (default: 0): the item damage/metadata value",
//"states": { "NAME_OF_STATE": "VALUE" }, <-- Will replace "data" when item states are implemented
"count": "INTEGER, optional (default: 1): the stack size required"
},
"B": "STRING: the item ID" //Shorthand - same as "B": { "item": "item ID" }
},
"result": { //Alternative shorthand -> "result": "item ID"
"item": "STRING: The ID of the item crafted"
//"data" & "count" parameters can also be used
},
"functions": [ //Optional, for special modifications
{
"function": "minecraft:return_items", //For keeping/replacing items in certain slots, like the buckets when making a cake
"item_keys": [ "A", "B" ], //STRING or STRING[]: the keys of the items to keep/replace
"return": { //the item to replace the original item with, leaving as a empty will give the player the item it had put in - Alternative shorthand -> "return": "item ID"
"item": "STRING: The ID of the item crafted"
//"data" & "count" parameters can also be used
},
"nbt": "STRING, optional: what tags to keep - empty means all tags, {} means none"
},
{
"function": "minecraft:zoom_map", //For Zooming in/out a map
"zoom_level": "INTEGER: How much the map should zoom in - negative values means zooming out",
"zoom_from": "STRING: Where the map should be zoomed in/out from, allowed values are: 'center', 'top', 'bottom', 'left', 'right', 'top_left', 'top_right', 'bottom_left', 'bottom_right'"
},
{
"function": "minecraft:repair", //For setting damage value compared to the other ingredients (only useable on items with durability)
"item_keys": [ "A", "B" ], //STRING or STRING[]: The keys of the items that get the durability combined into the final item
"bonus": "INTEGER (or FLOAT?), optional (default: 0): Additional percentage of bonus durability the returned item gets"
},
{
"function": "minecraft:copy_nbt", //For adding NBT data from the 'tag' tag to the returning item
"item_key": "A", //STRING: the keys of the items to copy the NBT from as integer - note, this runs before "return" runs, meaning the NBT from "return" is adding/replacing on top of the copied NBT
"copy": "STRING, optional: What tag to copy, empty/absent means all tags",
"paste": "STRING, optional: Where to paste the tag, empty/absent for same path as copy"
},
{
"function": "minecraft:add_nbt", //For adding nbt, only used with modifier_ingredients
"item_keys": [ "A", "B" ], //STRING or STRING[]: The keys of the items to add NBT data to
"nbt": "STRING: The tag(s) it adds",
"overwrite": "STRING, optional: what existing tags to overwrite if already present - empty means all tags, {} means none"
},
{
"function": "minecraft:color", //For coloring armor and fireworks
"coloring": "STRING: What exactly gets colored, so the correct calculation gets used, allowed values are: armor, fireworks, fireworks_fade, potion",
"item_keys": [ "A", "B" ], //STRING or STRING[]: The keys of the items to color
"color": [ 255, 255, 0 ] //INTEGER[]: The color value to add in RGB"
}
]
}
// Notes:
// First runs copy_nbt, then the nbt of return and then the nbt of add_nbt
// When NBT is copied, and a list which already exists is being specified in return, it adds to the end of the list, unless the returned list is empty.
// If the same id is found multiple times in the same recipe, it'll apply the function to all of them
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment