Interface ICraftingService

All Superinterfaces:
IGridService

public interface ICraftingService extends IGridService
  • Method Details

    • getCraftingFor

      Collection<IPatternDetails> getCraftingFor(AEKey whatToCraft)
      Parameters:
      whatToCraft - requested craft
      Returns:
      an unmodifiable collection of crafting patterns for the item in question.
    • isCraftable

      default boolean isCraftable(AEKey whatToCraft)
      Returns:
      true if the grid knows how to craft the given key
    • refreshNodeCraftingProvider

      void refreshNodeCraftingProvider(IGridNode node)
      Refreshes the crafting mounts provided by a node through its ICraftingProvider.
      Throws:
      IllegalArgumentException - If the given node is not part of this grid, or did not provide ICraftingProvider.
    • getFuzzyCraftable

      @Nullable @Nullable AEKey getFuzzyCraftable(AEKey whatToCraft, AEKeyFilter filter)
      Important: Never mutate the passed or returned stacks.
      Returns:
      another fuzzy equals stack that can be crafted and matches the filter, or null if none exists
    • beginCraftingCalculation

      Future<ICraftingPlan> beginCraftingCalculation(net.minecraft.world.level.Level level, ICraftingSimulationRequester simRequester, AEKey craftWhat, long amount, CalculationStrategy strategy)
      Begin calculating a crafting job.
      Parameters:
      level - crafting level
      simRequester - source
      craftWhat - result
      strategy - usually CalculationStrategy.REPORT_MISSING_ITEMS for player requests
      Returns:
      a future which will at an undetermined point in the future get you the ICraftingPlan do not wait on this, your be waiting forever.
    • submitJob

      ICraftingSubmitResult submitJob(ICraftingPlan job, @Nullable @Nullable ICraftingRequester requestingMachine, @Nullable @Nullable ICraftingCPU target, boolean prioritizePower, IActionSource src)
      Submit the job to the Crafting system for processing.

      If you send a requestingMachine you need to keep track of the resulting ICraftingLink, persist it to nbt, and expose it in ICraftingRequester.getRequestedJobs() so that the requester can be linked back to the CPU after a chunk unload / grid change.

      Parameters:
      job - - the crafting job from beginCraftingJob
      requestingMachine - - a machine if its being requested via automation, may be null.
      target - - can be null
      prioritizePower - - if cpu is null, this determine if the system should prioritize power, or if it should find the lower end cpus.
      src - - the action source to use when starting the job, this will be used for extracting items, should usually be the same as the one provided to beginCraftingJob.
      Returns:
      the success/failure state, and a crafting link in case if successful and there was a requestingMachine.
    • getCpus

      com.google.common.collect.ImmutableSet<ICraftingCPU> getCpus()
      Returns:
      list of all the crafting cpus on the grid
    • canEmitFor

      boolean canEmitFor(AEKey what)
      Parameters:
      what - to be requested item
      Returns:
      true if the item can be requested via a crafting emitter.
    • getCraftables

      Set<AEKey> getCraftables(AEKeyFilter filter)
      Get the set of things that can be crafted for a given storage channel.
    • isRequesting

      boolean isRequesting(AEKey what)
      Returns true if what is currently being requested for a crafting job in this grid.

      This means that its pattern was pushed to a provider and the result is now being awaited, or that more of the item is expected to be emitted. The final output of a job does not count as being requested.

      Parameters:
      what - item being crafted
      Returns:
      true if it is being crafting
    • getRequestedAmount

      long getRequestedAmount(AEKey what)
      Gets the total amount being requested across all crafting cpus of a grid.
      Parameters:
      what - the key for which the requested amount should be returned
      Returns:
      The total amount being requested.
    • isRequestingAny

      boolean isRequestingAny()
      Returns true if anything is currently being requested as part of a crafting job in this grid.
      See Also: