All Superinterfaces:
Comparable<IRecipeDefinition>
All Known Implementing Classes:
RecipeDefinition

public interface IRecipeDefinition extends Comparable<IRecipeDefinition>
Defines the inputs and outputs of a recipe. Inputs are ingredient prototypes for ingredient component types. Outputs are exact instances for ingredient component types. Implementing classes should properly implement the equals and hashCode methods.
  • Method Details

    • getInputComponents

      Set<IngredientComponent<?,?>> getInputComponents()
      Returns:
      The input ingredient component types.
    • getInputs

      <T, M> List<IPrototypedIngredientAlternatives<T,M>> getInputs(IngredientComponent<T,M> ingredientComponent)
      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.
      Type Parameters:
      T - The instance type.
      M - The matching condition parameter, may be Void.
      Parameters:
      ingredientComponent - An ingredient component type.
      Returns:
      Input prototypes.
    • isInputReusable

      <T, M> boolean isInputReusable(IngredientComponent<T,M> ingredientComponent, int index)
      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.
      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 in getInputs(IngredientComponent).
      Returns:
      If the input at this index is reusable.
    • getOutput

      IMixedIngredients getOutput()
      Returns:
      The output ingredients.
    • serialize

      static net.minecraft.nbt.CompoundTag serialize(net.minecraft.core.HolderLookup.Provider lookupProvider, IRecipeDefinition recipe)
      Deserialize a recipe to NBT.
      Parameters:
      lookupProvider - The lookup provider.
      recipe - A recipe.
      Returns:
      An NBT representation of the given recipe.
    • deserialize

      static RecipeDefinition deserialize(net.minecraft.core.HolderLookup.Provider lookupProvider, net.minecraft.nbt.CompoundTag tag) throws IllegalArgumentException
      Deserialize a recipe from NBT
      Parameters:
      lookupProvider - The lookup provider.
      tag - An NBT tag.
      Returns:
      A new mixed recipe instance.
      Throws:
      IllegalArgumentException - If the given tag is invalid or does not contain data on the given recipe.