Interface RecipeChoice
- All Known Subinterfaces:
RecipeChoice.ItemTypeChoice, RecipeChoice.PredicateChoice
- All Known Implementing Classes:
RecipeChoice.ExactChoice, RecipeChoice.MaterialChoice
Represents a potential item match within a recipe. All choices within a
recipe must be satisfied for it to be craftable. Choices must never be
null or air.
This class is not legal for implementation by plugins!
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classRepresents a choice that will be valid only if one of the stacks is exactly matched (aside from stack size).static interfaceRepresents a choice that will be valid if theItemStack.getType()matches any of the item types in the set.static classRepresents a choice of multiple matching Materials.static interfaceRepresents a choice that will be valid only if an item matches the given predicate. -
Method Summary
Modifier and TypeMethodDescriptionclone()static RecipeChoiceempty()An "empty" recipe choice.static RecipeChoice.ExactChoiceexactChoice(List<ItemStack> stacks) Creates a choice that will be valid only if one of the stacks is exactly matched (aside from stack size).static RecipeChoice.ExactChoiceexactChoice(ItemStack first, ItemStack... others) Creates a choice that will be valid only if one of the stacks is exactly matched (aside from stack size).Deprecated.for compatibility onlystatic RecipeChoice.ItemTypeChoiceitemType(RegistryKeySet<ItemType> itemTypes) Creates a new recipe choice based on aRegistryKeySetof item types.static RecipeChoice.ItemTypeChoiceCreates a new recipe choice based on a collection ofItemTypes.static RecipeChoice.PredicateChoicepredicateChoice(Predicate<? super ItemStack> stackPredicate, ItemStack exampleStack) Creates a recipe choice that will be valid only if an item matches the given predicate.booleandefault RecipeChoicevalidate(boolean allowEmptyRecipes)
-
Method Details
-
empty
An "empty" recipe choice. Only valid as a recipe choice in specific places. Check the javadocs of a method before using it to be sure it's valid for that recipe and ingredient type.- Returns:
- the empty recipe choice
-
itemType
@Contract(pure=true, value="_, _ -> new") static RecipeChoice.ItemTypeChoice itemType(ItemType itemType, ItemType... itemTypes) Creates a new recipe choice based on a collection ofItemTypes.- Parameters:
itemType- the first item type to matchitemTypes- other item types to match.- Returns:
- a new recipe choice
-
itemType
@Contract(pure=true, value="_ -> new") static RecipeChoice.ItemTypeChoice itemType(RegistryKeySet<ItemType> itemTypes) Creates a new recipe choice based on aRegistryKeySetof item types. Can either be created viaRegistrySet.keySet(RegistryKey, TypedKey[])or obtained fromRegistry.getTag(TagKey).- Parameters:
itemTypes- the item types to match- Returns:
- a new recipe choice
-
exactChoice
@Contract(value="_, _ -> new", pure=true) static RecipeChoice.ExactChoice exactChoice(ItemStack first, ItemStack... others) Creates a choice that will be valid only if one of the stacks is exactly matched (aside from stack size).- Parameters:
first- an ItemStack to match against. Cannot be null or empty/air.others- additional ItemStacks to match against.- Returns:
- a new ExactChoice
-
exactChoice
@Contract(value="_ -> new", pure=true) static RecipeChoice.ExactChoice exactChoice(List<ItemStack> stacks) Creates a choice that will be valid only if one of the stacks is exactly matched (aside from stack size).- Parameters:
stacks- the ItemStacks to match against. Cannot be empty or contain empty/air stacks.- Returns:
- a new ExactChoice
-
predicateChoice
@Contract(value="_, _ -> new", pure=true) static RecipeChoice.PredicateChoice predicateChoice(Predicate<? super ItemStack> stackPredicate, ItemStack exampleStack) Creates a recipe choice that will be valid only if an item matches the given predicate.Note: Mutating the
ItemStackwithin the predicate is not supported.- Parameters:
stackPredicate- the predicate to match against.exampleStack- an exampleItemStackto be shown in the recipe book. Cannot be empty or air.- Returns:
- a new PredicateChoice
-
getItemStack
Deprecated.for compatibility onlyGets a single item stack representative of this stack choice.- Returns:
- a single representative item
-
clone
RecipeChoice clone() -
test
-
validate
-