Class PendingCraftingJobResultIndexObserver<T,M>

java.lang.Object
org.cyclops.integratedcrafting.core.PendingCraftingJobResultIndexObserver<T,M>
All Implemented Interfaces:
org.cyclops.integrateddynamics.core.network.IIngredientChannelInsertPreConsumer<T>

public class PendingCraftingJobResultIndexObserver<T,M> extends Object implements org.cyclops.integrateddynamics.core.network.IIngredientChannelInsertPreConsumer<T>
An ingredient index observer that tracks crafting job outputs for a certain ingredient component type. It will observe changes and (partially) resolve awaiting crafting job outputs when applicable.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.cyclops.integrateddynamics.core.network.IIngredientChannelInsertPreConsumer

    org.cyclops.integrateddynamics.core.network.IIngredientChannelInsertPreConsumer.Result<T extends Object>
  • Constructor Summary

    Constructors
    Constructor
    Description
    PendingCraftingJobResultIndexObserver(org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent, CraftingJobHandler handler, ICraftingNetwork craftingNetwork)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.cyclops.integrateddynamics.core.network.IIngredientChannelInsertPreConsumer.Result<T>
    addIngredient(T instance, T unclaimed, int channel, boolean simulate)
    This adds the given instance to the waiting crafting jobs directly, without having to go through the network storage and its observers.
    org.cyclops.integrateddynamics.core.network.IIngredientChannelInsertPreConsumer.Result<T>
    insert(int channel, T ingredient, T unclaimed, boolean simulate)
     
    protected void
    onPendingIngredientsEmpty(it.unimi.dsi.fastutil.objects.ObjectIterator<it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry<List<Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<?,?>>>>>> jobsEntryIt, it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry<List<Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<?,?>>>>> jobsEntry, Iterator<Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<?,?>>>> jobEntryIt, Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<?,?>>> jobEntry, List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<T,M>> pendingIngredients, int craftingJobId)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.cyclops.integrateddynamics.core.network.IIngredientChannelInsertPreConsumer

    insert
  • Constructor Details

    • PendingCraftingJobResultIndexObserver

      public PendingCraftingJobResultIndexObserver(org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<T,M> ingredientComponent, CraftingJobHandler handler, ICraftingNetwork craftingNetwork)
  • Method Details

    • addIngredient

      public org.cyclops.integrateddynamics.core.network.IIngredientChannelInsertPreConsumer.Result<T> addIngredient(T instance, T unclaimed, int channel, boolean simulate)
      This adds the given instance to the waiting crafting jobs directly, without having to go through the network storage and its observers. This will first attempt to complete running jobs that are awaiting results. Then, it will try to give the instance to the dependent jobs based on their missing ingredients. Only the part of the instance that is still unclaimed may resolve pending outputs, as every crafting interface observes the same insertion. Without that, one produced instance would resolve the pending output of every parallel job at once, which would make those jobs report completion before their outputs are actually available.
      Parameters:
      instance - The instance to add.
      unclaimed - The part of the instance that no crafting interface has claimed yet.
      channel - The channel.
      simulate - Simulate mode.
      Returns:
      The remaining instance that could not be given to any jobs that had missing ingredients, and the part of it that is still unclaimed.
    • onPendingIngredientsEmpty

      protected void onPendingIngredientsEmpty(it.unimi.dsi.fastutil.objects.ObjectIterator<it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry<List<Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<?,?>>>>>> jobsEntryIt, it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry<List<Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<?,?>>>>> jobsEntry, Iterator<Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<?,?>>>> jobEntryIt, Map<org.cyclops.commoncapabilities.api.ingredient.IngredientComponent<?,?>,List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<?,?>>> jobEntry, List<org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient<T,M>> pendingIngredients, int craftingJobId)
    • insert

      public org.cyclops.integrateddynamics.core.network.IIngredientChannelInsertPreConsumer.Result<T> insert(int channel, @NotNull T ingredient, @NotNull T unclaimed, boolean simulate)
      Specified by:
      insert in interface org.cyclops.integrateddynamics.core.network.IIngredientChannelInsertPreConsumer<T>