Class RecipeDefinition
java.lang.Object
org.cyclops.commoncapabilities.api.capability.recipehandler.RecipeDefinition
- All Implemented Interfaces:
Comparable<IRecipeDefinition>
,IRecipeDefinition
A recipe definition based on maps.
-
Constructor Summary
ConstructorDescriptionRecipeDefinition
(Map<IngredientComponent<?, ?>, List<IPrototypedIngredientAlternatives<?, ?>>> inputs, Map<IngredientComponent<?, ?>, List<Boolean>> inputsReusable, IMixedIngredients output) RecipeDefinition
(Map<IngredientComponent<?, ?>, List<IPrototypedIngredientAlternatives<?, ?>>> inputs, IMixedIngredients output) -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(IRecipeDefinition that) boolean
Set
<IngredientComponent<?, ?>> <T,
M> List <IPrototypedIngredientAlternatives<T, M>> getInputs
(IngredientComponent<T, M> ingredientComponent) Get the input prototypes of a certain type.int
hashCode()
<T,
M> boolean isInputReusable
(IngredientComponent<T, M> ingredientComponent, int index) If the input at the given index is reusable.static <T,
R, M> RecipeDefinition ofAlternatives
(IngredientComponent<T, M> component, List<IPrototypedIngredientAlternatives<T, M>> alternatives, IMixedIngredients output) Create a new recipe definition for a single component type input and a list of alternatives.static <T,
R, M> RecipeDefinition ofIngredient
(IngredientComponent<T, M> component, List<IPrototypedIngredient<T, M>> ingredient, IMixedIngredients output) Create a new recipe definittion for a single component type input and a single instance.static <T,
R, M> RecipeDefinition ofIngredients
(IngredientComponent<T, M> component, List<List<IPrototypedIngredient<T, M>>> ingredients, IMixedIngredients output) Create a new recipe definition for a single component type input and a list of instances.toString()
-
Constructor Details
-
RecipeDefinition
public RecipeDefinition(Map<IngredientComponent<?, ?>, List<IPrototypedIngredientAlternatives<?, ?>>> inputs, IMixedIngredients output) -
RecipeDefinition
public RecipeDefinition(Map<IngredientComponent<?, ?>, List<IPrototypedIngredientAlternatives<?, ?>>> inputs, Map<IngredientComponent<?, ?>, List<Boolean>> inputsReusable, IMixedIngredients output)
-
-
Method Details
-
getInputComponents
- Specified by:
getInputComponents
in interfaceIRecipeDefinition
- Returns:
- The input ingredient component types.
-
getInputs
public <T,M> List<IPrototypedIngredientAlternatives<T,M>> getInputs(IngredientComponent<T, M> ingredientComponent) Description copied from interface:IRecipeDefinition
Get the input prototypes of a certain type. The first list contains a list of ingredients, whereas the deeper second list contains different prototype-based alternatives for the ingredient at this position.- Specified by:
getInputs
in interfaceIRecipeDefinition
- Type Parameters:
T
- The instance type.M
- The matching condition parameter, may be Void.- Parameters:
ingredientComponent
- An ingredient component type.- Returns:
- Input prototypes.
-
isInputReusable
Description copied from interface:IRecipeDefinition
If the input at the given index is reusable. If an ingredient is reusable, this means that a crafting job for this recipe will not (fully) consume this ingredient, and could potentially be reused in later crafting jobs.- Specified by:
isInputReusable
in interfaceIRecipeDefinition
- Type Parameters:
T
- The instance type.M
- The matching condition parameter, may be Void.- Parameters:
ingredientComponent
- An ingredient component type.index
- The index of an input, based on the order inIRecipeDefinition.getInputs(IngredientComponent)
.- Returns:
- If the input at this index is reusable.
-
getOutput
- Specified by:
getOutput
in interfaceIRecipeDefinition
- Returns:
- The output ingredients.
-
equals
-
hashCode
public int hashCode() -
toString
-
ofAlternatives
public static <T,R, RecipeDefinition ofAlternativesM> (IngredientComponent<T, M> component, List<IPrototypedIngredientAlternatives<T, M>> alternatives, IMixedIngredients output) Create a new recipe definition for a single component type input and a list of alternatives.- Type Parameters:
T
- The instance type.R
- The recipe target type, may be Void.M
- The matching condition parameter, may be Void.- Parameters:
component
- A component type.alternatives
- The alternatives for the given component type.output
- The recipe output.- Returns:
- A new recipe definition.
-
ofIngredients
public static <T,R, RecipeDefinition ofIngredientsM> (IngredientComponent<T, M> component, List<List<IPrototypedIngredient<T, M>>> ingredients, IMixedIngredients output) Create a new recipe definition for a single component type input and a list of instances.- Type Parameters:
T
- The instance type.R
- The recipe target type, may be Void.M
- The matching condition parameter, may be Void.- Parameters:
component
- A component type.ingredients
- The ingredients for the given component type.output
- The recipe output.- Returns:
- A new recipe definition.
-
ofIngredient
public static <T,R, RecipeDefinition ofIngredientM> (IngredientComponent<T, M> component, List<IPrototypedIngredient<T, M>> ingredient, IMixedIngredients output) Create a new recipe definittion for a single component type input and a single instance.- Type Parameters:
T
- The instance type.R
- The recipe target type, may be Void.M
- The matching condition parameter, may be Void.- Parameters:
component
- A component type.ingredient
- An ingredient for the given component type.output
- The recipe output.- Returns:
- A new recipe definition.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<IRecipeDefinition>
-