Class StoneCutterRecipeHandler
- All Implemented Interfaces:
IRecipeHandler<net.minecraft.world.item.crafting.StonecutterRecipe>
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.blamejared.crafttweaker.api.recipe.handler.IRecipeHandler
IRecipeHandler.For, IRecipeHandler.ReplacementNotSupportedException -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondumpToCommandString(IRecipeManager manager, net.minecraft.world.item.crafting.StonecutterRecipe recipe) Creates a String representation of a validaddRecipe(or alternative) call for the given subclass ofRecipe.Optional<Function<net.minecraft.resources.ResourceLocation,net.minecraft.world.item.crafting.StonecutterRecipe>> replaceIngredients(IRecipeManager manager, net.minecraft.world.item.crafting.StonecutterRecipe recipe, List<IReplacementRule> rules) Handles the replacement of ingredients according to the given set ofIReplacementRules for the given subclass ofRecipe.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.blamejared.crafttweaker.api.recipe.handler.IRecipeHandler
doesConflict
-
Constructor Details
-
StoneCutterRecipeHandler
public StoneCutterRecipeHandler()
-
-
Method Details
-
dumpToCommandString
public String dumpToCommandString(IRecipeManager manager, net.minecraft.world.item.crafting.StonecutterRecipe recipe) Description copied from interface:IRecipeHandlerCreates a String representation of a validaddRecipe(or alternative) call for the given subclass ofRecipe.Recipe dumps are triggered by the
/ct recipesor/ct recipes handcommands.All newlines added to either the start or the end of the string will be automatically trimmed.
- Specified by:
dumpToCommandStringin interfaceIRecipeHandler<net.minecraft.world.item.crafting.StonecutterRecipe>- Parameters:
manager- The recipe manager responsible for this kind of recipes.recipe- The recipe that is currently being dumped.- Returns:
- A String representing a
addRecipe(or similar) call.
-
replaceIngredients
public Optional<Function<net.minecraft.resources.ResourceLocation,net.minecraft.world.item.crafting.StonecutterRecipe>> replaceIngredients(IRecipeManager manager, net.minecraft.world.item.crafting.StonecutterRecipe recipe, List<IReplacementRule> rules) Description copied from interface:IRecipeHandlerHandles the replacement of ingredients according to the given set ofIReplacementRules for the given subclass ofRecipe.This method should try to apply all of the applicable rules to the recipe. If one of the rules fails to apply, an error message should be generated via
CraftTweakerAPI.LOGGER. Incomplete application of the replacement rules may or may not apply depending on the specific implementation: no specific contracts are enforced by this method.If a particular recipe handler does not support replacement, a
IRecipeHandler.ReplacementNotSupportedExceptionshould be raised, along with a helpful error message. A recipe handler must be consistent, meaning that given the same recipe class, the behavior should be consistent: either an exception gets thrown or the replacement gets carried out.- Specified by:
replaceIngredientsin interfaceIRecipeHandler<net.minecraft.world.item.crafting.StonecutterRecipe>- Parameters:
manager- The recipe manager responsible for this kind of recipes.recipe- The recipe whose ingredients should be replaced.rules- A series ofIReplacementRules in the order they should be applied. Implementations are nevertheless allowed to reorder these rules as they see fit. Refer to the implementation specifications for more details.- Returns:
- An
Optionalcontaining a function that creates the replaced recipe, if any replacements have been carried out. If no replacement rule affected the current recipe, the return value should beOptional.empty(). The parameter of the function will be the new ID of the recipe that should be used, as determined by the method caller: the name may correspond to the old one or be a completely new one, implementations are not allowed to make any assumptions on the value of this parameter. It is customary, though not required, that the value returned by the wrapped function is a completely different object fromrecipe(i.e.recipe != result.get().apply(recipe.getId())).
-