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 ofItemStackSnapshot
s used to display the ingredient in a recipe.static Ingredient
empty()
An empty ingredient.static Ingredient
of
(ItemStackLike @Nullable ... items) Creates a newIngredient
for the providedItemStackLike
s.static Ingredient
Creates a newIngredient
for the providedItemType
s.static Ingredient
of
(DefaultedRegistryReference<? extends ItemType> @Nullable ... itemTypes) Creates a newIngredient
for the providedItemType
s.static Ingredient
of
(ResourceKey key) static Ingredient
of
(ResourceKey key, Predicate<? super ItemStackLike> predicate, ItemStackLike... exemplaryStacks) boolean
test
(ItemStackLike item)
-
Method Details
-
empty
An empty ingredient.- Returns:
- The empty ingredient
-
test
-
displayedItems
List<ItemStackSnapshot> displayedItems()Returns the list ofItemStackSnapshot
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
@SafeVarargs static Ingredient of(DefaultedRegistryReference<? extends ItemType> @Nullable ... itemTypes) Creates a newIngredient
for the providedItemType
s.- Parameters:
itemTypes
- The items- Returns:
- The new ingredient
-
of
Creates a newIngredient
for the providedItemStackLike
s.- Parameters:
items
- The item- Returns:
- The new ingredient
-
of
static Ingredient of(ResourceKey key, Predicate<? super ItemStackLike> predicate, ItemStackLike... exemplaryStacks) Creates a newIngredient
for the providedPredicate
and exemplaryItemStackLike
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
-