Class SmithingTrimRecipeHandler
- All Implemented Interfaces:
IRecipeHandler<net.minecraft.world.item.crafting.SmithingTrimRecipe>
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.blamejared.crafttweaker.api.recipe.handler.IRecipeHandler
IRecipeHandler.For -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecompose(IRecipeManager<? super net.minecraft.world.item.crafting.SmithingTrimRecipe> manager, net.minecraft.world.item.crafting.SmithingTrimRecipe recipe) Decomposes a recipe from its complete form into anIDecomposedRecipe.<U extends net.minecraft.world.item.crafting.Recipe<?>>
booleandoesConflict(IRecipeManager<? super net.minecraft.world.item.crafting.SmithingTrimRecipe> manager, net.minecraft.world.item.crafting.SmithingTrimRecipe firstRecipe, U secondRecipe) Checks if the two recipes conflict with each other.dumpToCommandString(IRecipeManager<? super net.minecraft.world.item.crafting.SmithingTrimRecipe> manager, net.minecraft.world.item.crafting.SmithingTrimRecipe recipe) Creates a String representation of a validaddRecipe(or alternative) call for the given subclass ofRecipe.Optional<net.minecraft.world.item.crafting.SmithingTrimRecipe>recompose(IRecipeManager<? super net.minecraft.world.item.crafting.SmithingTrimRecipe> manager, net.minecraft.resources.ResourceLocation name, IDecomposedRecipe recipe) Reconstructs a complete recipe from its decomposed form.
-
Constructor Details
-
SmithingTrimRecipeHandler
public SmithingTrimRecipeHandler()
-
-
Method Details
-
dumpToCommandString
public String dumpToCommandString(IRecipeManager<? super net.minecraft.world.item.crafting.SmithingTrimRecipe> manager, net.minecraft.world.item.crafting.SmithingTrimRecipe 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.SmithingTrimRecipe>- 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.
-
doesConflict
public <U extends net.minecraft.world.item.crafting.Recipe<?>> boolean doesConflict(IRecipeManager<? super net.minecraft.world.item.crafting.SmithingTrimRecipe> manager, net.minecraft.world.item.crafting.SmithingTrimRecipe firstRecipe, U secondRecipe) Description copied from interface:IRecipeHandlerChecks if the two recipes conflict with each other.In this case, a conflict is defined as the two recipes being made in the exact same way (e.g. with the same shape and the same ingredients if the two recipes are shaped crafting table ones).
Conflicts are also considered symmetrical in this implementation, which means that if
firstRecipeconflicts withsecondRecipe, the opposite is also true.- Specified by:
doesConflictin interfaceIRecipeHandler<net.minecraft.world.item.crafting.SmithingTrimRecipe>- Type Parameters:
U- The type ofsecondRecipe.- Parameters:
manager- The recipe manager responsible for this kind of recipes.firstRecipe- The recipe which should be checked for conflict.secondRecipe- The other recipe whichfirstRecipeshould be checked against. The recipe may or may not be of the same type offirstRecipe. See the API note section for more details.- Returns:
- Whether the
firstRecipeconflicts withsecondRecipeor not.
-
decompose
public Optional<IDecomposedRecipe> decompose(IRecipeManager<? super net.minecraft.world.item.crafting.SmithingTrimRecipe> manager, net.minecraft.world.item.crafting.SmithingTrimRecipe recipe) Description copied from interface:IRecipeHandlerDecomposes a recipe from its complete form into anIDecomposedRecipe.The decomposition needs to be complete, meaning that any meaningful part of the recipe should be present in the returned decomposed recipe. The only exception is the name, as decomposed recipes only track
IRecipeComponents, and names aren't one.It is allowed for an implementation to specify that the given recipe cannot be properly decomposed. Examples of this occurrence might be recipes whose behavior is completely determined by code, such as map cloning in vanilla. In this context, it is allowed to return
Optional.empty().It is mandatory for a recipe handler to produce a decomposed recipe that can then be converted back into its complete form in
IRecipeHandler.recompose(IRecipeManager, ResourceLocation, IDecomposedRecipe). In other words, if the return value of this method isn't empty, thenrecompose(manager, name, decompose(manager, recipe).get())must not return an empty optional.- Specified by:
decomposein interfaceIRecipeHandler<net.minecraft.world.item.crafting.SmithingTrimRecipe>- Parameters:
manager- The recipe manager responsible for this kind of recipes.recipe- The recipe that should be decomposed.- Returns:
- An
Optionalwrapping decomposed recipe, or an empty one if need be as specified above.
-
recompose
public Optional<net.minecraft.world.item.crafting.SmithingTrimRecipe> recompose(IRecipeManager<? super net.minecraft.world.item.crafting.SmithingTrimRecipe> manager, net.minecraft.resources.ResourceLocation name, IDecomposedRecipe recipe) Description copied from interface:IRecipeHandlerReconstructs a complete recipe from its decomposed form.The recomposition should be as complete as possible, making sure that all
IRecipeComponents that are necessary to properly rebuild the recipe are present in the givenIDecomposedRecipe. If the recipe presents unknown components, i.e. components that this handler doesn't know how to convert, the handler is allowed to throw an exception as detailed in the following paragraphs.It is allowed for an implementation to return
Optional.empty()in case the recomposition fails for any reason, or if no decomposed recipe can be used to rebuild a recipe in its complete form, e.g. for map cloning in vanilla.It is mandatory for a recipe handler that knows how to decompose a recipe to also know how to recompose it. In other words, if
IRecipeHandler.decompose(IRecipeManager, Recipe)returns a non-emptyOptional, thenrecompose(manager, name, decompose(manager, recipe).get())must not return an empty optional nor throw an exception.- Specified by:
recomposein interfaceIRecipeHandler<net.minecraft.world.item.crafting.SmithingTrimRecipe>- Parameters:
manager- The recipe manager responsible for this kind of recipes.name- The name to give to the recomposed recipe once it has been built. It is mandatory thatRecipe.getId()and this parameter represent the same name.recipe- TheIDecomposedRecipethat should be recomposed back into a complete form.- Returns:
- An
Optionalwrapping the complete form of the recipe, or an empty one if need be as specified above.
-