Class PatternDetailsHelper

java.lang.Object
appeng.api.crafting.PatternDetailsHelper

public final class PatternDetailsHelper extends Object
  • Constructor Details

    • PatternDetailsHelper

      public PatternDetailsHelper()
  • Method Details

    • registerDecoder

      public static void registerDecoder(IPatternDetailsDecoder decoder)
    • encodedPatternItemBuilder

      public static <T extends IPatternDetails> EncodedPatternItemBuilder<T> encodedPatternItemBuilder(EncodedPatternDecoder<T> decoder)
      Creates a new encoded pattern item based on the given decoder. Your mod must register this item and use it, when it encodes its patterns. You do not need to register an additional decoder for the returned item.
    • encodedPatternItemBuilder

      public static <T extends IPatternDetails> EncodedPatternItemBuilder<T> encodedPatternItemBuilder(com.google.common.base.Function<AEItemKey,T> decoder)
      Convenience method for decoders that do not need access to the level to decode a pattern.
      See Also:
    • isEncodedPattern

      public static boolean isEncodedPattern(net.minecraft.world.item.ItemStack stack)
    • decodePattern

      @Nullable public static @Nullable IPatternDetails decodePattern(AEItemKey what, net.minecraft.world.level.Level level)
    • decodePattern

      @Nullable public static @Nullable IPatternDetails decodePattern(net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level level)
    • encodeProcessingPattern

      public static net.minecraft.world.item.ItemStack encodeProcessingPattern(List<GenericStack> sparseInputs, List<GenericStack> sparseOutputs)
      Encodes a processing pattern which represents the ability to convert the given inputs into the given outputs using some process external to the ME system.
      Parameters:
      sparseOutputs - The first element is considered the primary output and must be present
      Returns:
      A new encoded pattern.
      Throws:
      IllegalArgumentException - If either in or out contain only empty ItemStacks, or no primary output
    • encodeCraftingPattern

      public static net.minecraft.world.item.ItemStack encodeCraftingPattern(net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.CraftingRecipe> recipe, net.minecraft.world.item.ItemStack[] in, net.minecraft.world.item.ItemStack out, boolean allowSubstitutes, boolean allowFluidSubstitutes)
      Encodes a crafting pattern which represents a Vanilla crafting recipe.
      Parameters:
      recipe - The Vanilla crafting recipe to be encoded.
      in - The items in the crafting grid, which are used to determine what items are supplied from the ME system to craft using this pattern.
      out - What is to be expected as the result of this crafting operation by the ME system.
      allowSubstitutes - Controls whether the ME system will allow the use of equivalent items to craft this recipe.
      allowFluidSubstitutes - Controls whether the ME system will allow the use of equivalent fluids.
      Throws:
      IllegalArgumentException - If either in or out contain only empty ItemStacks.
    • encodeStonecuttingPattern

      public static net.minecraft.world.item.ItemStack encodeStonecuttingPattern(net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.StonecutterRecipe> recipe, AEItemKey in, AEItemKey out, boolean allowSubstitutes)
      Encodes a stonecutting pattern which represents a Vanilla Stonecutter recipe.
      Parameters:
      recipe - The Vanilla stonecutter recipe to be encoded.
      in - The input item for the stonecutter, which is used to determine which item is supplied from the ME system to craft using this pattern.
      out - The selected output item from the stonecutter recipe. Used to restore the recipe if it is renamed later.
      allowSubstitutes - Controls whether the ME system will allow the use of equivalent items to craft this recipe.
    • encodeSmithingTablePattern

      public static net.minecraft.world.item.ItemStack encodeSmithingTablePattern(net.minecraft.world.item.crafting.RecipeHolder<net.minecraft.world.item.crafting.SmithingRecipe> recipe, AEItemKey template, AEItemKey base, AEItemKey addition, AEItemKey out, boolean allowSubstitutes)
      Encodes a smithing table pattern which represents a Vanilla Smithing Table recipe.
      Parameters:
      recipe - The Vanilla smithing table recipe to be encoded.
      template - The template item for the smithing table.
      base - The base item for the smithing table, which is used to determine which item is supplied from the ME system to craft using this pattern.
      addition - The additional item for the smithing table, which is used to determine which item is supplied from the ME system to craft using this pattern.
      out - The selected output item from the smithing table recipe. Used to restore the recipe if it is renamed later.
      allowSubstitutes - Controls whether the ME system will allow the use of equivalent items to craft this recipe.