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
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic Ingredient.Builderbuilder()Creates a newIngredient.Builderto build anIngredient.Returns the list ofItemStackSnapshots used to display the ingredient in a recipe.static Ingredientempty()An empty ingredient.static Ingredientof(ItemStackLike @Nullable ... items) Creates a newIngredientfor the providedItemStackLikes.static IngredientCreates a newIngredientfor the providedItemTypes.static Ingredientof(DefaultedRegistryReference<? extends ItemType> @Nullable ... itemTypes) Creates a newIngredientfor the providedItemTypes.static Ingredientof(ResourceKey key) static Ingredientof(ResourceKey key, Predicate<? super ItemStackLike> predicate, ItemStackLike... exemplaryStacks) booleantest(ItemStackLike item)
-
Method Details
-
empty
An empty ingredient.- Returns:
- The empty ingredient
-
test
-
displayedItems
List<ItemStackSnapshot> displayedItems()Returns the list ofItemStackSnapshots 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.Builderto build anIngredient.- Returns:
- The new builder
-
of
Creates a newIngredientfor the providedItemTypes.- Parameters:
itemTypes- The items- Returns:
- The new ingredient
-
of
@SafeVarargs static Ingredient of(DefaultedRegistryReference<? extends ItemType> @Nullable ... itemTypes) Creates a newIngredientfor the providedItemTypes.- Parameters:
itemTypes- The items- Returns:
- The new ingredient
-
of
Creates a newIngredientfor the providedItemStackLikes.- Parameters:
items- The item- Returns:
- The new ingredient
-
of
static Ingredient of(ResourceKey key, Predicate<? super ItemStackLike> predicate, ItemStackLike... exemplaryStacks) Creates a newIngredientfor the providedPredicateand exemplaryItemStackLikes.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
-