Interface Ingredient
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Ingredient.Builder
Builder forIngredient
s.static interface
Ingredient.Factory
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Ingredient.Builder
builder()
Creates a newIngredient.Builder
to build anIngredient
.java.util.List<ItemStackSnapshot>
displayedItems()
Returns the list ofItemStack
s used to display the ingredient in a recipe.static Ingredient
empty()
An empty ingredient.static Ingredient
of(@Nullable ItemStack... items)
Creates a newIngredient
for the providedItemStack
s.static Ingredient
of(@Nullable ItemStackSnapshot... items)
Creates a newIngredient
for the providedItemStackSnapshot
s.static Ingredient
of(@Nullable ItemType... itemTypes)
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, java.util.function.Predicate<ItemStack> predicate, ItemStack... exemplaryStacks)
boolean
test(ItemStack itemStack)
-
-
-
Method Detail
-
empty
static Ingredient empty()
An empty ingredient.- Returns:
- The empty ingredient
-
test
boolean test(ItemStack itemStack)
- Specified by:
test
in interfacejava.util.function.Predicate<ItemStack>
-
displayedItems
java.util.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
static Ingredient.Builder builder()
Creates a newIngredient.Builder
to build anIngredient
.- Returns:
- The new builder
-
of
static Ingredient of(@Nullable ItemType... itemTypes)
Creates a newIngredient
for the providedItemType
s.- Parameters:
itemTypes
- The items- Returns:
- The new ingredient
-
of
static Ingredient of(@Nullable ItemStack... items)
Creates a newIngredient
for the providedItemStack
s.- Parameters:
items
- The items- Returns:
- The new ingredient
-
of
static Ingredient of(@Nullable ItemStackSnapshot... items)
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
static Ingredient of(ResourceKey key, java.util.function.Predicate<ItemStack> predicate, ItemStack... exemplaryStacks)
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
static Ingredient of(ResourceKey key)
- Parameters:
key
- The key- Returns:
- The new ingredient
-
-