Class PendingCraftingJobResultIndexObserver<T,M>

java.lang.Object
org.cyclops.integratedcrafting.core.PendingCraftingJobResultIndexObserver<T,M>
All Implemented Interfaces:
org.cyclops.integrateddynamics.api.ingredient.IIngredientComponentStorageObservable.IIndexChangeObserver<T,M>

public class PendingCraftingJobResultIndexObserver<T,M> extends Object implements org.cyclops.integrateddynamics.api.ingredient.IIngredientComponentStorageObservable.IIndexChangeObserver<T,M>
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.
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    org.cyclops.commoncapabilities.api.ingredient.IngredientInstanceWrapper<T,M>
    addIngredient(org.cyclops.commoncapabilities.api.ingredient.IngredientInstanceWrapper<T,M> instanceWrapper, int channel)
    This adds the given instance to the waiting crafting jobs directly, without having to go through the network storage and its observers.
    void
    onChange(org.cyclops.integrateddynamics.api.ingredient.IIngredientComponentStorageObservable.StorageChangeEvent<T,M> event)
     
    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
  • Constructor Details

    • PendingCraftingJobResultIndexObserver

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

    • onChange

      public void onChange(org.cyclops.integrateddynamics.api.ingredient.IIngredientComponentStorageObservable.StorageChangeEvent<T,M> event)
      Specified by:
      onChange in interface org.cyclops.integrateddynamics.api.ingredient.IIngredientComponentStorageObservable.IIndexChangeObserver<T,M>
    • addIngredient

      public org.cyclops.commoncapabilities.api.ingredient.IngredientInstanceWrapper<T,M> addIngredient(org.cyclops.commoncapabilities.api.ingredient.IngredientInstanceWrapper<T,M> instanceWrapper, int channel)
      This adds the given instance to the waiting crafting jobs directly, without having to go through the network storage and its observers. Like the method above, 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.
      Parameters:
      instanceWrapper - The instance to add.
      channel - The channel.
      Returns:
      The remaining instance that could not be given to any jobs that had missing ingredients.
    • 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)