Interface Ingredient
An Ingredient for a crafting recipe.
Crafting recipes can only be crafted when all of the ingredients match the items in the input grid.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Ingredient.Builder
builder()
Creates a newIngredient.Builder
to build anIngredient
.Returns the list ofItemStack
s used to display the ingredient in a recipe.static Ingredient
empty()
An empty ingredient.static Ingredient
Creates a newIngredient
for the providedItemStack
s.static Ingredient
of
(@Nullable ItemStackSnapshot... items) Creates a newIngredient
for the providedItemStackSnapshot
s.static Ingredient
Creates a newIngredient
for the providedItemType
s.static Ingredient
of
(@Nullable DefaultedRegistryReference<? extends ItemType>... itemTypes) Creates a newIngredient
for the providedItemType
s.static Ingredient
of
(ResourceKey key) static Ingredient
of
(ResourceKey key, Predicate<ItemStack> predicate, ItemStack... exemplaryStacks) boolean
-
Method Details
-
empty
An empty ingredient.- Returns:
- The empty ingredient
-
test
-
displayedItems
List<ItemStackSnapshot> displayedItems()Returns the list ofItemStack
s used to display the ingredient in a recipe. These are not necessarily all the items that this Ingredient can match.- Returns:
- The list of items to display the Ingredient in a recipe.
-
builder
Creates a newIngredient.Builder
to build anIngredient
.- Returns:
- The new builder
-
of
Creates a newIngredient
for the providedItemType
s.- Parameters:
itemTypes
- The items- Returns:
- The new ingredient
-
of
Creates a newIngredient
for the providedItemStack
s.- Parameters:
items
- The items- Returns:
- The new ingredient
-
of
Creates a newIngredient
for the providedItemStackSnapshot
s.- Parameters:
items
- The item- Returns:
- The new ingredient
-
of
@SafeVarargs static Ingredient of(@Nullable DefaultedRegistryReference<? extends ItemType>... itemTypes) Creates a newIngredient
for the providedItemType
s.- Parameters:
itemTypes
- The items- Returns:
- The new ingredient
-
of
Creates a newIngredient
for the providedPredicate
and exemplaryItemStack
s.Note: Predicate ingredients may not be fully supported for all recipe types
- Parameters:
key
- A unique resource keypredicate
- The predicateexemplaryStacks
- The exemplary items- Returns:
- The new ingredient
-
of
- Parameters:
key
- The key- Returns:
- The new ingredient
-