Class FullIngredientReplacementRule
java.lang.Object
com.blamejared.crafttweaker.api.recipe.replacement.rule.FullIngredientReplacementRule
- All Implemented Interfaces:
IReplacementRule
-
Field Summary
Fields inherited from interface com.blamejared.crafttweaker.api.recipe.handler.IReplacementRule
EMPTY -
Method Summary
Modifier and TypeMethodDescriptionstatic IReplacementRulecreate(IIngredient from, IIngredient to) describe()Describes in a short and simple sentence the behavior of this rule.<T,U extends net.minecraft.world.item.crafting.Recipe<?>>
Optional<T>getReplacement(T ingredient, Class<T> type, U recipe) Attempts to replace the given ingredient, with typetype, according to the rules defined by this replacement rule.
-
Method Details
-
create
-
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:IReplacementRuleAttempts to replace the given ingredient, with typetype, according to the rules defined by this replacement rule.- Specified by:
getReplacementin interfaceIReplacementRule- 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 thattype.isAssignableFrom(ingredient.getClass()), but the equality checktype == ingredient.getClass()is not guaranteed).recipe- The recipe that is currently being subjected to replacement, if any;nullotherwise.- Returns:
- An
Optionalcontaining 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
Description copied from interface:IReplacementRuleDescribes in a short and simple sentence the behavior of this rule.- Specified by:
describein interfaceIReplacementRule- Returns:
- The description of this rule.
-