Class StoneCutterRecipeHandler

java.lang.Object
com.blamejared.crafttweaker.impl.recipe.handler.type.vanilla.StoneCutterRecipeHandler
All Implemented Interfaces:
IRecipeHandler<net.minecraft.world.item.crafting.StonecutterRecipe>

@For(net.minecraft.world.item.crafting.StonecutterRecipe.class) public final class StoneCutterRecipeHandler extends Object implements 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
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    decompose(IRecipeManager<? super net.minecraft.world.item.crafting.StonecutterRecipe> manager, net.minecraft.core.RegistryAccess registryAccess, net.minecraft.world.item.crafting.StonecutterRecipe recipe)
    Decomposes a recipe from its complete form into an IDecomposedRecipe.
    <U extends net.minecraft.world.item.crafting.Recipe<?>>
    boolean
    doesConflict(IRecipeManager<? super net.minecraft.world.item.crafting.StonecutterRecipe> manager, net.minecraft.world.item.crafting.StonecutterRecipe firstRecipe, U secondRecipe)
    Checks if the two recipes conflict with each other.
    dumpToCommandString(IRecipeManager<? super net.minecraft.world.item.crafting.StonecutterRecipe> manager, net.minecraft.core.RegistryAccess registryAccess, net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.StonecutterRecipe> holder)
    Creates a String representation of a valid addRecipe (or alternative) call for the given subclass of Recipe.
    Optional<net.minecraft.world.item.crafting.StonecutterRecipe>
    recompose(IRecipeManager<? super net.minecraft.world.item.crafting.StonecutterRecipe> manager, net.minecraft.core.RegistryAccess registryAccess, IDecomposedRecipe recipe)
    Reconstructs a complete recipe from its decomposed form.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StoneCutterRecipeHandler

      public StoneCutterRecipeHandler()
  • Method Details

    • dumpToCommandString

      public String dumpToCommandString(IRecipeManager<? super net.minecraft.world.item.crafting.StonecutterRecipe> manager, net.minecraft.core.RegistryAccess registryAccess, net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.StonecutterRecipe> holder)
      Description copied from interface: IRecipeHandler
      Creates a String representation of a valid addRecipe (or alternative) call for the given subclass of Recipe.

      Recipe dumps are triggered by the /ct recipes or /ct recipes hand commands.

      All newlines added to either the start or the end of the string will be automatically trimmed.

      Specified by:
      dumpToCommandString in interface IRecipeHandler<net.minecraft.world.item.crafting.StonecutterRecipe>
      Parameters:
      manager - The recipe manager responsible for this kind of recipes.
      registryAccess - Access to registries to get the output of recipes.
      holder - 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.StonecutterRecipe> manager, net.minecraft.world.item.crafting.StonecutterRecipe firstRecipe, U secondRecipe)
      Description copied from interface: IRecipeHandler
      Checks 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 firstRecipe conflicts with secondRecipe, the opposite is also true.

      Specified by:
      doesConflict in interface IRecipeHandler<net.minecraft.world.item.crafting.StonecutterRecipe>
      Type Parameters:
      U - The type of secondRecipe.
      Parameters:
      manager - The recipe manager responsible for this kind of recipes.
      firstRecipe - The recipe which should be checked for conflict.
      secondRecipe - The other recipe which firstRecipe should be checked against. The recipe may or may not be of the same type of firstRecipe. See the API note section for more details.
      Returns:
      Whether the firstRecipe conflicts with secondRecipe or not.
    • decompose

      public Optional<IDecomposedRecipe> decompose(IRecipeManager<? super net.minecraft.world.item.crafting.StonecutterRecipe> manager, net.minecraft.core.RegistryAccess registryAccess, net.minecraft.world.item.crafting.StonecutterRecipe recipe)
      Description copied from interface: IRecipeHandler
      Decomposes a recipe from its complete form into an IDecomposedRecipe.

      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, RegistryAccess, IDecomposedRecipe). In other words, if the return value of this method isn't empty, then recompose(manager, name, decompose(manager, recipe).get()) must not return an empty optional.

      Specified by:
      decompose in interface IRecipeHandler<net.minecraft.world.item.crafting.StonecutterRecipe>
      Parameters:
      manager - The recipe manager responsible for this kind of recipes.
      registryAccess - Access to registries to get the output of recipes.
      recipe - The recipe that should be decomposed.
      Returns:
      An Optional wrapping decomposed recipe, or an empty one if need be as specified above.
    • recompose

      public Optional<net.minecraft.world.item.crafting.StonecutterRecipe> recompose(IRecipeManager<? super net.minecraft.world.item.crafting.StonecutterRecipe> manager, net.minecraft.core.RegistryAccess registryAccess, IDecomposedRecipe recipe)
      Description copied from interface: IRecipeHandler
      Reconstructs 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 given IDecomposedRecipe. 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, RegistryAccess, Recipe) returns a non-empty Optional, then recompose(manager, name, decompose(manager, recipe).get()) must not return an empty optional nor throw an exception.

      Specified by:
      recompose in interface IRecipeHandler<net.minecraft.world.item.crafting.StonecutterRecipe>
      Parameters:
      manager - The recipe manager responsible for this kind of recipes.
      registryAccess - Access to registries.
      recipe - The IDecomposedRecipe that should be recomposed back into a complete form.
      Returns:
      An Optional wrapping the complete form of the recipe, or an empty one if need be as specified above.