Interface ITerminalStorageTabIngredientCraftingHandler<O extends ITerminalCraftingOption<?>,I>

Type Parameters:
O - The type of crafting option.
I - The type of crafting plan identifier.
All Known Implementing Classes:
TerminalStorageTabIngredientCraftingHandlerCraftingNetwork

public interface ITerminalStorageTabIngredientCraftingHandler<O extends ITerminalCraftingOption<?>,I>
Handles crafting actions inside ingredient-based terminal storage tabs.
  • Method Details

    • getId

      net.minecraft.resources.ResourceLocation getId()
      Returns:
      The unique id of this handler.
    • getChannels

      <T, M> int[] getChannels(TerminalStorageTabIngredientComponentServer<T,M> tab)
      Type Parameters:
      T - The instance type.
      M - The matching condition parameter.
      Parameters:
      tab - An ingredient tab.
      Returns:
      All channels that have crafting options.
    • getCraftingOptions

      <T, M> Collection<O> getCraftingOptions(TerminalStorageTabIngredientComponentServer<T,M> tab, int channel)
      Get all crafting options in the given tab.
      Type Parameters:
      T - The instance type.
      M - The matching condition parameter.
      Parameters:
      tab - An ingredient tab.
      channel - The channel to get the options for.
      Returns:
      Crafting options.
    • getCraftingOptionsWithOutput

      <T, M> Collection<O> getCraftingOptionsWithOutput(TerminalStorageTabIngredientComponentServer<T,M> tab, int channel, T instance, M matchCondition)
      Get all crafting options in the given tab that produce the given output instance.
      Type Parameters:
      T - The instance type.
      M - The matching condition parameter.
      Parameters:
      tab - An ingredient tab.
      channel - The channel to get the options for.
      instance - The expect output instance.
      matchCondition - The expected output match condition.
      Returns:
      Crafting options.
    • serializeCraftingOption

      net.minecraft.nbt.CompoundTag serializeCraftingOption(O craftingOption)
      Serialize a crafting option to NBT.
      Parameters:
      craftingOption - A crafting option.
      Returns:
      An NBT tag.
    • deserializeCraftingOption

      <T, M> O deserializeCraftingOption(org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent, net.minecraft.nbt.CompoundTag tag) throws IllegalArgumentException
      Deserialize a crafting option from NBT.
      Type Parameters:
      T - The instance type.
      M - The matching condition parameter.
      Parameters:
      ingredientComponent - The ingredient component for the crafting option.
      tag - An NBT tag representing a crafting option.
      Returns:
      A crafting option.
      Throws:
      IllegalArgumentException - If the given tag was invalid.
    • calculateCraftingPlan

      ITerminalCraftingPlan<I> calculateCraftingPlan(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, ITerminalCraftingOption craftingOption, long quantity)
      Calculate a crafting plan for the given crafting option.
      Parameters:
      network - The network in which the plan should be calculated.
      channel - The channel to get the options for.
      craftingOption - A crafting option.
      quantity - The requested output quantity.
      Returns:
      The calculated crafting plan.
    • serializeCraftingPlan

      default net.minecraft.nbt.CompoundTag serializeCraftingPlan(ITerminalCraftingPlan<I> craftingPlan)
      Serialize a crafting plan to NBT.
      Parameters:
      craftingPlan - A crafting plan.
      Returns:
      An NBT tag.
    • deserializeCraftingPlan

      default ITerminalCraftingPlan<I> deserializeCraftingPlan(net.minecraft.nbt.CompoundTag tag) throws IllegalArgumentException
      Deserialize a crafting plan from NBT.
      Parameters:
      tag - An NBT tag representing a crafting plan.
      Returns:
      A crafting option.
      Throws:
      IllegalArgumentException - If the given tag was invalid.
    • serializeCraftingPlanFlat

      default net.minecraft.nbt.CompoundTag serializeCraftingPlanFlat(ITerminalCraftingPlanFlat<I> craftingPlan)
      Serialize a flat crafting plan to NBT.
      Parameters:
      craftingPlan - A flat crafting plan.
      Returns:
      An NBT tag.
    • deserializeCraftingPlanFlat

      default ITerminalCraftingPlanFlat<I> deserializeCraftingPlanFlat(net.minecraft.nbt.CompoundTag tag) throws IllegalArgumentException
      Deserialize a flat crafting plan from NBT.
      Parameters:
      tag - An NBT tag representing a flat crafting plan.
      Returns:
      A crafting option.
      Throws:
      IllegalArgumentException - If the given tag was invalid.
    • serializeCraftingJobId

      net.minecraft.nbt.Tag serializeCraftingJobId(I id)
      Serializes a crafting job id.
      Parameters:
      id - An id.
      Returns:
      An NBT tag.
    • deserializeCraftingJobId

      I deserializeCraftingJobId(net.minecraft.nbt.Tag tag)
      Deserialize a crafting job id.
      Parameters:
      tag - An NBT tag.
      Returns:
      An id.
    • startCraftingJob

      void startCraftingJob(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, ITerminalCraftingPlan<I> craftingPlan, net.minecraft.server.level.ServerPlayer player) throws CraftingJobStartException
      Start a crafting job.
      Parameters:
      network - The network in which the plan should be started.
      channel - The channel to get the options for.
      craftingPlan - A crafting plan.
      player - The player that started the crafting job.
      Throws:
      CraftingJobStartException - If the crafting job failed to start.
    • getCraftingJobs

      List<ITerminalCraftingPlan<I>> getCraftingJobs(org.cyclops.integrateddynamics.api.network.INetwork network, int channel)
      Parameters:
      network - The network in which the plan should be started.
      channel - The channel to get the options for.
      Returns:
      All running crafting plans.
    • getCraftingJob

      @Nullable ITerminalCraftingPlan<I> getCraftingJob(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, I craftingJobId)
      Get the crafting job with the given id.
      Parameters:
      network - The network in which the plan should be started.
      channel - The channel to get the options for.
      craftingJobId - A crafting job id.
      Returns:
      A crafting job or null.
    • cancelCraftingJob

      boolean cancelCraftingJob(org.cyclops.integrateddynamics.api.network.INetwork network, int channel, I craftingJobId)
      Cancel the crafting job with the given id.
      Parameters:
      network - The network in which the plan should be started.
      channel - The channel to get the options for.
      craftingJobId - A crafting job id.
      Returns:
      If the crafting job was successfully cancelled.