{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/minecraft-data-pack-recipe/latest.json",
  "title": "minecraft data pack recipe",
  "description": "Configuration file defining a recipe for a data pack for Minecraft.",
  "x-lintel": {
    "source": "https://www.schemastore.org/minecraft-recipe.json",
    "sourceSha256": "814ec3b5c61f869a2bb30517ad2d09567e72306a509641b088b273d21d90c826",
    "fileMatch": [
      "**/data/*/recipes/*.json"
    ],
    "parsers": [
      "json"
    ]
  },
  "type": "object",
  "properties": {
    "type": {
      "description": "The type of recipe.",
      "type": "string",
      "enum": [
        "minecraft:blasting",
        "minecraft:campfire_cooking",
        "minecraft:crafting_shaped",
        "minecraft:crafting_shapeless",
        "minecraft:smelting",
        "minecraft:smithing",
        "minecraft:smoking",
        "minecraft:stonecutting"
      ]
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:blasting"
          }
        }
      },
      "then": {
        "description": "Represents a recipe in a blast furnace.",
        "anyOf": [
          {
            "$ref": "#/$defs/tagsCommonToAllRecipes"
          },
          {
            "$ref": "#/$defs/tagsCommonToAllCookingRecipes"
          },
          {
            "$ref": "#/$defs/cookingRecipeCategory"
          }
        ]
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:campfire_cooking"
          }
        }
      },
      "then": {
        "description": "Represents a recipe in a campfire.",
        "anyOf": [
          {
            "$ref": "#/$defs/tagsCommonToAllRecipes"
          },
          {
            "$ref": "#/$defs/tagsCommonToAllCookingRecipes"
          },
          {
            "$ref": "#/$defs/cookingRecipeCategory"
          }
        ]
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:crafting_shaped"
          }
        }
      },
      "then": {
        "description": "Represents a shaped crafting recipe in a crafting table.",
        "anyOf": [
          {
            "$ref": "#/$defs/tagsCommonToAllRecipes"
          },
          {
            "$ref": "#/$defs/commonRecipeCategory"
          }
        ],
        "properties": {
          "pattern": {
            "description": "A list of single-character keys used to describe a pattern for shaped crafting.",
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 3
            },
            "maxItems": 3
          },
          "key": {
            "title": "key",
            "description": "All keys used for this shaped crafting recipe.",
            "additionalProperties": {
              "type": [
                "object",
                "array"
              ],
              "description": "The ingredient corresponding to this key.",
              "properties": {
                "item": {
                  "description": "An item ID.",
                  "type": "string"
                },
                "tag": {
                  "description": "An item tag.",
                  "type": "string"
                }
              },
              "items": {
                "properties": {
                  "item": {
                    "description": "An item ID.",
                    "type": "string"
                  },
                  "tag": {
                    "description": "An item tag.",
                    "type": "string"
                  }
                }
              }
            }
          },
          "result": {
            "$ref": "#/$defs/result"
          }
        },
        "type": "object"
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:crafting_shapeless"
          }
        }
      },
      "then": {
        "description": "Represents a shapeless crafting recipe in a crafting table.",
        "anyOf": [
          {
            "$ref": "#/$defs/tagsCommonToAllRecipes"
          },
          {
            "$ref": "#/$defs/commonRecipeCategory"
          }
        ],
        "properties": {
          "ingredients": {
            "description": "A list of entries for this shapeless crafting recipe.",
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/$defs/ingredient",
                  "title": "ingredient",
                  "description": "An entry made of a single ingredient.",
                  "type": "object"
                },
                {
                  "description": "An entry made of a list of acceptable ingredients.",
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 9,
                  "items": {
                    "$ref": "#/$defs/ingredient"
                  }
                }
              ]
            }
          },
          "result": {
            "$ref": "#/$defs/result"
          }
        },
        "type": "object"
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:smelting"
          }
        }
      },
      "then": {
        "description": "Represents a recipe in a furnace.",
        "anyOf": [
          {
            "$ref": "#/$defs/tagsCommonToAllRecipes"
          },
          {
            "$ref": "#/$defs/tagsCommonToAllCookingRecipes"
          },
          {
            "$ref": "#/$defs/cookingRecipeCategory"
          }
        ]
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:smithing"
          }
        }
      },
      "then": {
        "$ref": "#/$defs/tagsCommonToAllRecipes",
        "description": "Represents a recipe in a smithing table.",
        "properties": {
          "base": {
            "$ref": "#/$defs/item",
            "title": "base",
            "description": "Ingredient specifying an item to be upgraded."
          },
          "addition": {
            "$ref": "#/$defs/item",
            "title": "addition"
          },
          "result": {
            "title": "result",
            "type": "object"
          }
        },
        "type": "object"
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:smoking"
          }
        }
      },
      "then": {
        "description": "Represents a recipe in a smoker.",
        "anyOf": [
          {
            "$ref": "#/$defs/tagsCommonToAllRecipes"
          },
          {
            "$ref": "#/$defs/tagsCommonToAllCookingRecipes"
          },
          {
            "$ref": "#/$defs/cookingRecipeCategory"
          }
        ]
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "minecraft:stonecutting"
          }
        }
      },
      "then": {
        "$ref": "#/$defs/tagsCommonToAllRecipes",
        "description": "Represents a recipe in a stonecutter.",
        "oneOf": [
          {
            "$ref": "#/$defs/item",
            "title": "ingredient",
            "description": "The ingredient for the recipe."
          },
          {
            "title": "ingredient",
            "description": "The list of ingredients for the recipe.",
            "type": "array",
            "items": {
              "$ref": "#/$defs/item",
              "title": "ingredient"
            }
          }
        ],
        "properties": {
          "result": {
            "description": "An item ID. The output item of the recipe.",
            "type": "string"
          },
          "count": {
            "description": "The amount of the output item.",
            "type": "integer"
          }
        },
        "type": "object"
      }
    }
  ],
  "$defs": {
    "item": {
      "type": "object",
      "properties": {
        "item": {
          "description": "An item ID.",
          "type": "string"
        },
        "tag": {
          "description": "An item tag.",
          "type": "string"
        }
      }
    },
    "ingredient": {
      "$ref": "#/$defs/item",
      "title": "ingredient",
      "description": "An acceptable ingredient.",
      "type": "object"
    },
    "tagsCommonToAllRecipes": {
      "type": "object",
      "properties": {
        "type": {
          "description": "A namespaced ID indicating the type of serializer of the recipe.",
          "type": "string"
        },
        "group": {
          "description": "A string identifier. Used to group multiple recipes together in the recipe book.",
          "type": "string"
        },
        "show_notification": {
          "description": "If a notification is shown when the recipe is unlocked.",
          "type": "boolean"
        }
      }
    },
    "tagsCommonToAllCookingRecipes": {
      "type": "object",
      "properties": {
        "ingredient": {
          "$ref": "#/$defs/ingredient",
          "title": "ingredients",
          "description": "The ingredients.",
          "type": [
            "object",
            "array"
          ],
          "items": {
            "$ref": "#/$defs/ingredient"
          }
        },
        "result": {
          "description": "An item ID. The output item of the recipe.",
          "type": "string"
        },
        "experience": {
          "description": "The output experience of the recipe.",
          "type": "number"
        },
        "cookingtime": {
          "description": "The cook time of the recipe in ticks.",
          "type": "integer"
        }
      }
    },
    "commonRecipeCategory": {
      "title": "category",
      "description": "Category of common recipes (in recipe book).",
      "type": "object",
      "properties": {
        "category": {
          "type": "string",
          "enum": [
            "building",
            "redstone",
            "equipment",
            "misc"
          ]
        }
      }
    },
    "cookingRecipeCategory": {
      "title": "category",
      "description": "Category of cooking recipes (in recipe book).",
      "type": "object",
      "properties": {
        "category": {
          "type": "string",
          "enum": [
            "food",
            "blocks",
            "misc "
          ]
        }
      }
    },
    "result": {
      "title": "result",
      "description": "The output item of the recipe.",
      "type": "object",
      "properties": {
        "count": {
          "description": "The amount of the item.",
          "type": "integer",
          "default": 1
        },
        "item": {
          "description": "An item ID.",
          "type": "string"
        }
      }
    }
  },
  "$comment": "https://minecraft.wiki/w/Recipe#JSON_format"
}
