Ingredients
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:
tag
.
If set, this ingredient matches the specified item. Cannot be set alongside item
.
If set, this ingredient matches the specified tag. Cannot be set alongside
The ingredient object.
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.
- Fields from either of the above ingredient forms.
An ingredient object.
The ingredient list.
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:
- Forge registry. Type of the ingredient, as defined in the
- Other fields based on the ingredient type.
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:
forge:intersection
.
Always - Item ingredient to match.
A list of ingredients, matches if all ingredient in the list matches.
The ingredient object.
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:
forge:difference
.
Always - Item ingredient that must match.
- Item ingredient that must not match.
The ingredient object.
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:
- Item that must match.
- Exact NBT on the item stack, represented as a JSON object.
- Exact NBT on the item stack, represented as a string.
The ingredient object.
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:
items
.
Item that must match. Cannot be set alongside item
.- A single item option.
List of items, item must match any of them. Cannot be set alongside - Partial NBT on the item stack, represented as a JSON object.
- Partial NBT on the item stack, represented as a string.
The ingredient object.
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:
mantle:fluid_container
.
Always - Item must contain fluid matching this ingredient exactly.
- If set, this ingredient will be used for the display item stacks in recipe viewers. If unset, the display item stacks will be empty.
The ingredient object.
Alternatively, the fluid container ingredient can be written in the following compact form when matching a single fluid or Fluid tag:
mantle:fluid_container
.
Always tag
.
If set, this ingredient matches items containing the specified fluid. Cannot be set alongside fluid
.
If set, this ingredient matches items containing the specified Fluid tag. Cannot be set alongside - Item must contain exactly this much fluid.
fluid
in 1.19.2. Still supported but deprecated, may be removed in a future version of Mantle.
Used in 1.18.2 and before to set a specific fluid to match; was renamed to
The ingredient object.
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:
tconstruct:block_tag
.
Always - The block form of the item must match the given tag.
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:
tconstruct:no_container
.
Always - If set, this ingredient matches the specified item.
- If set, this ingredient matches the specified tag.
- Item ingredient to match.
The ingredient object.
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:
tconstruct:material
.
Always - If set, this ingredient matches the specified item.
- If set, this ingredient matches the specified tag.
- Item ingredient to match.
- If set, item’s material must match the specified material.
- If set, the item’s material must match any of the materials in the tag.
The ingredient object.
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:
tconstruct:tool_hook
.
Always tconstruct:modifiable
.
Item tag that must match on the tool. If unset, defaults to - Tool hook that must match.
The ingredient object.
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:
- Item ingredient to match.
- The minimum stack size for the input item stack. If unset, defaults to 1.
The sized ingredient object.
A sized ingredient can also be represented more compactly in one of the following forms:
tag
.
If set, this ingredient matches the specified item. Cannot be set alongside item
.
If set, this ingredient matches the specified tag. Cannot be set alongside - The minimum stack size for the input item stack. If unset, defaults to 1.
The sized ingredient object.
For custom ingredient types, this compact form is only allowed if the custom type does not use amount_needed
as one of its fields:
- custom ingredients. Type of the ingredient, see
- The minimum stack size for the input item stack. If unset, defaults to 1.
- Other fields based on the ingredient type.
The sized ingredient object.
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:
tag
.
If set, this ingredient matches the specified fluid. Cannot be set alongside fluid
.
If set, this ingredient matches the specified tag. Cannot be set alongside - Minimum fluid amount. The fluid stack must have an equal or greater amount to match.
fluid
in 1.19.2. Still supported but deprecated, may be removed in a future version of Mantle.
Used in 1.18.2 and before to set a specific fluid to match; was renamed to
The fluid ingredient object.
Alternatively, a fluid ingredient can be expressed as a list to match multiple fluid ingredients under an “or” condition:
- A fluid ingredient to match.
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:
- If set, this ingredient matches the specified entity types.
- An entity type to match.
If set, this ingredient matches any of the specified entity types.
- If set, this ingredient matches the specified tag.
The fluid ingredient object.
Alternatively, an entity ingredient can be expressed as a list to match multiple entity ingredients under an “or” condition:
- An entity ingredient to match.
A list of entity ingredients. Matches if any entry in the list matches.