Ingredients are used in many different JSON formats to represent an input which also has the ability to display a full list of matching inputs (unlike predicates).

Item Ingredients

See also: Forge Read the Docs.

Item ingredients, often called simply “ingredients”, represent an input that matches item stacks. Ingredients can match based on both item properties and item stack NBT, and typically should ignore item stack size.

Item ingredients can be represented in several forms, as covered by the following subsections.

Basic

Basic ingredients as defined by Minecraft are represented as an object with either an item or a tag. They have the following form:

  • (Object): The ingredient object.
    • item (Item ID): If set, this ingredient matches the specified item. Cannot be set alongside tag.
    • tag (Item tag): If set, this ingredient matches the specified tag. Cannot be set alongside item.

Compound

A compound ingredient matches if any of the nested ingredients matches. Unlike other ingredient types, compound ingredients are represented as an array instead of an object.

  • (Array): The ingredient list.
    • (Object): An ingredient object.
      • Fields from either of the above ingredient forms.

Custom

Forge allows mods to define custom item ingredient types which override the vanilla serializer for ingredients. This allows matching items on more complex conditions than item type or tag, and allows matching item stacks based on NBT. The basic form for a custom is as follows:

  • (Object): The ingredient object.

The rest of this section covers various custom ingredient types added by Forge, Mantle, and Tinkers’ Construct.

Intersection

Intersection ingredients are a Forge ingredient that matches if all of the children in the ingredient match. They have the following format:

  • (Object): The ingredient object.
    • type (Resource Location): Always forge:intersection.
    • children (Array): A list of ingredients, matches if all ingredient in the list matches.

Difference

Difference ingredients are a Forge ingredient that matches if the first ingredient matches, but the second does not, allowing for a set subtraction. They have the following format:

Strict NBT

Strict NBT ingredients are a Forge ingredient that matches if the given NBT matches the item stack exactly. They have the following format:

  • (Object): The ingredient object.
    • item (Item ID): Item that must match.
    • nbt (Object): Exact NBT on the item stack, represented as a JSON object.
    • nbt (String): Exact NBT on the item stack, represented as a string.

The ingredient will not match if the item has any NBT beyond that which is specified here.

Partial NBT

Partial NBT ingredients are a Forge ingredient that matches if the given NBT matches the item stack, ignoring any fields not specified in the NBT. They have the following format:

  • (Object): The ingredient object.
    • item (Item ID): Item that must match. Cannot be set alongside items.
    • items (Array): List of items, item must match any of them. Cannot be set alongside item.
    • nbt (Object): Partial NBT on the item stack, represented as a JSON object.
    • nbt (String): Partial NBT on the item stack, represented as a string.

The ingredient will ignore any NBT on the item beyond that which is specified in the nbt field.

Fluid Container

Fluid container ingredients are a Mantle ingredient that matches if the given item stack is a fluid container and contains the specified fluid exactly. In addition, the item stack’s “craft remainder” must exactly match the item when drained of the specified fluid. This restriction is due to the fact most recipes that support ingredients do not support callbacks to specify how an ingredient is consumed, limiting this ingredient to match only exact fluid amounts. It is typically most useful to mimic bucket-like containers that only support a single size of fluid, rather than dynamic containers that can be partially drained.

The fluid container ingredient has the following format:

  • (Object): The ingredient object.
    • type (Resource Location): Always mantle:fluid_container.
    • fluid (Fluid Ingredient): Item must contain fluid matching this ingredient exactly.
    • display (Item Ingredient): If set, this ingredient will be used for the display item stacks in recipe viewers. If unset, the display item stacks will be empty.

Alternatively, the fluid container ingredient can be written in the following compact form when matching a single fluid or Fluid tag:

  • (Object): The ingredient object.
    • type (Resource Location): Always mantle:fluid_container.
    • fluid (Fluid ID): If set, this ingredient matches items containing the specified fluid. Cannot be set alongside tag.
    • tag (Fluid tag): If set, this ingredient matches items containing the specified Fluid tag. Cannot be set alongside fluid.
    • amount (Integer): Item must contain exactly this much fluid.
    • name (Fluid ID): Used in 1.18.2 and before to set a specific fluid to match; was renamed to fluid in 1.19.2. Still supported but deprecated, may be removed in a future version of Mantle.

Block Tag

Block tag ingredients are added by Tinkers’ Construct, and match any item whose block form matches the given block tag. It will fail to match if the block form does not match the tag or if the item has no block form. They have the following format:

  • (Object): The ingredient object.

No Container

No container ingredients are an ingredient added by Tinkers’ Construct, matching items that have no craft remainder item (sometimes called a container). Practically, this ingredient is useful with a fluid container to match only the empty form of the container rather than filled forms. This ingredient has the following format:

  • (Object): The ingredient object.
    • type (Resource Location): Always tconstruct:no_container.
    • item (Item ID): If set, this ingredient matches the specified item.
    • tag (Item tag): If set, this ingredient matches the specified tag.
    • match (Item Ingredient): Item ingredient to match.

Note that a no container ingredient may only set one of item, tag, and match.

Material

Material ingredients are an ingredient added by Tinkers’ Construct, matching a material on an item stack. Alternatively, they are often used without setting the material or material tag to simply display an item stack with all its material variants in recipes.

Material ingredients have the following format:

  • (Object): The ingredient object.
    • type (Resource Location): Always tconstruct:material.
    • item (Item ID): If set, this ingredient matches the specified item.
    • tag (Item tag): If set, this ingredient matches the specified tag.
    • match (Item Ingredient): Item ingredient to match.
    • material (Material Variant): If set, item’s material must match the specified material.
    • material_tag (material tag): If set, the item’s material must match any of the materials in the tag.

Note that a material ingredient may only set one of item, tag, and match. In addition, it is never useful to set both material and material_tag.

Tool Hook

Tool hook ingredients are ingredients added by Tinkers’ Construct that match tools supporting a particular tool hook in their tool definition. This ingredient is notably used for the trait variant of the rebalanced modifier to ensure its only craftable if the tool actually has a rebalanced trait. This ingredient has the following format:

  • (Object): The ingredient object.
    • type (Resource Location): Always tconstruct:tool_hook.
    • tag (Item tag): Item tag that must match on the tool. If unset, defaults to tconstruct:modifiable.
    • hook (Tool Hook ID): Tool hook that must match.

Sized

A sized ingredient is a special type of item ingredient added by Mantle. It is used in many recipe types to allow an ingredient to have size based inputs, matching if the item stack size is larger than or equal to the specified size. Unlike other variants of item ingredients, sized ingredients only work in contents that specifically support sized ingredients; it is not possible to make an ingredient sized unless the recipe format requests sized ingredients.

A sized ingredient has the following format:

  • (Object): The sized ingredient object.
    • ingredient (Item Ingredient): Item ingredient to match.
    • amount_needed (Integer): The minimum stack size for the input item stack. If unset, defaults to 1.

A sized ingredient can also be represented more compactly in one of the following forms:

  • (Object): The sized ingredient object.
    • item (Item ID): If set, this ingredient matches the specified item. Cannot be set alongside tag.
    • tag (Item tag): If set, this ingredient matches the specified tag. Cannot be set alongside item.
    • amount_needed (Integer): The minimum stack size for the input item stack. If unset, defaults to 1.

For custom ingredient types, this compact form is only allowed if the custom type does not use amount_needed as one of its fields:

  • (Object): The sized ingredient object.
    • type (Resource Location): Type of the ingredient, see custom ingredients.
    • amount_needed (Integer): The minimum stack size for the input item stack. If unset, defaults to 1.
    • Other fields based on the ingredient type.

Fluid Ingredients

Fluid ingredients are a type of ingredient added by Mantle, matching fluid inputs in recipes. Unlike item ingredients, they do not support checking the NBT of a fluid stack, but they do support matching the fluid stack size. The most basic form of a fluid ingredient is as follows:

  • (Object): The fluid ingredient object.
    • fluid (Fluid ID): If set, this ingredient matches the specified fluid. Cannot be set alongside tag.
    • tag (Fluid tag): If set, this ingredient matches the specified tag. Cannot be set alongside fluid.
    • amount (Integer): Minimum fluid amount. The fluid stack must have an equal or greater amount to match.
    • name (Fluid ID): Used in 1.18.2 and before to set a specific fluid to match; was renamed to fluid in 1.19.2. Still supported but deprecated, may be removed in a future version of Mantle.

Alternatively, a fluid ingredient can be expressed as a list to match multiple fluid ingredients under an “or” condition:

  • (Array): A list of fluid ingredients, any of which must match. The amount is determined by the first match.

Entity Ingredients

Entity ingredients are a type of ingredient added by Mantle, matching entity type inputs in recipes. They do not support matching on any properties beyond the entity type. Entity ingredients are defined with one of the following three mutually exclusive keys:

  • (Object): The fluid ingredient object.
    • type (Entity ID): If set, this ingredient matches the specified entity types.
    • types (Array): If set, this ingredient matches any of the specified entity types.
    • tag (Entity Type tag): If set, this ingredient matches the specified tag.

Alternatively, an entity ingredient can be expressed as a list to match multiple entity ingredients under an “or” condition:

  • (Array): A list of entity ingredients. Matches if any entry in the list matches.