Class FullIngredientReplacementRule

java.lang.Object
com.blamejared.crafttweaker.api.recipe.replacement.rule.FullIngredientReplacementRule
All Implemented Interfaces:
IReplacementRule

public final class FullIngredientReplacementRule extends Object implements IReplacementRule
  • Method Details

    • create

      public static IReplacementRule create(IIngredient from, IIngredient to)
    • getReplacement

      public <T, U extends net.minecraft.world.item.crafting.Recipe<?>> Optional<T> getReplacement(T ingredient, Class<T> type, U recipe)
      Description copied from interface: IReplacementRule
      Attempts to replace the given ingredient, with type type, according to the rules defined by this replacement rule.
      Specified by:
      getReplacement in interface IReplacementRule
      Type Parameters:
      T - The type of the ingredient that should be replaced.
      U - The type of the recipe that is currently being replaced.
      Parameters:
      ingredient - The ingredient that should be replaced.
      type - The type of the ingredient that should be replaced. Its value may or may not correspond to the actual ingredient's class, although it's guaranteed to be one of its superclasses (in other words, it is guaranteed that type.isAssignableFrom(ingredient.getClass()), but the equality check type == ingredient.getClass() is not guaranteed).
      recipe - The recipe that is currently being subjected to replacement, if any; null otherwise.
      Returns:
      An Optional containing the replaced ingredient, if this rule knows how to operate on the ingredient's type and deems that the ingredient should be replaced; Optional.empty() otherwise.
    • describe

      public String describe()
      Description copied from interface: IReplacementRule
      Describes in a short and simple sentence the behavior of this rule.
      Specified by:
      describe in interface IReplacementRule
      Returns:
      The description of this rule.