Class IngredientComponentStorageSlottedEmpty<T,M>

java.lang.Object
org.cyclops.commoncapabilities.api.ingredient.storage.IngredientComponentStorageEmpty<T,M>
org.cyclops.commoncapabilities.api.ingredient.storage.IngredientComponentStorageSlottedEmpty<T,M>
All Implemented Interfaces:
Iterable<T>, IIngredientComponentStorage<T,M>, IIngredientComponentStorageSlotted<T,M>

public class IngredientComponentStorageSlottedEmpty<T,M> extends IngredientComponentStorageEmpty<T,M> implements IIngredientComponentStorageSlotted<T,M>
A dummy slotted ingredient component storage that is empty.
  • Constructor Details

    • IngredientComponentStorageSlottedEmpty

      public IngredientComponentStorageSlottedEmpty(IngredientComponent<T,M> component)
  • Method Details

    • getSlots

      public int getSlots()
      Specified by:
      getSlots in interface IIngredientComponentStorageSlotted<T,M>
      Returns:
      The number of available slots.
    • getSlotContents

      public T getSlotContents(int slot)
      Description copied from interface: IIngredientComponentStorageSlotted
      Get the ingredient that is contained in the given slot. Note: The returned ingredient MUST NOT not be modified by the caller.
      Specified by:
      getSlotContents in interface IIngredientComponentStorageSlotted<T,M>
      Parameters:
      slot - A slot number.
      Returns:
      The contained ingredient.
    • getMaxQuantity

      public long getMaxQuantity(int slot)
      Description copied from interface: IIngredientComponentStorageSlotted
      Get the maximum allowed quantity in the given slot.
      Specified by:
      getMaxQuantity in interface IIngredientComponentStorageSlotted<T,M>
      Parameters:
      slot - A slot number.
      Returns:
      The maximum allowed in the given slot.
    • insert

      public T insert(int slot, @Nonnull T ingredient, net.neoforged.neoforge.transfer.transaction.TransactionContext transaction)
      Description copied from interface: IIngredientComponentStorageSlotted
      Inserts an ingredient into the storage in the given slot and return the remainder. The ingredient should not be modified in this function!
      Specified by:
      insert in interface IIngredientComponentStorageSlotted<T,M>
      Parameters:
      slot - A slot number to insert to.
      ingredient - Ingredient to insert.
      transaction - The transaction context.
      Returns:
      The remaining ingredient that was not inserted (if the entire ingredient is accepted, then return IIngredientMatcher.getEmptyInstance()). May be the same as the input ingredient if unchanged, otherwise a new ingredient.
    • extract

      public T extract(int slot, long maxQuantity, net.neoforged.neoforge.transfer.transaction.TransactionContext transaction)
      Description copied from interface: IIngredientComponentStorageSlotted
      Extract the at most the given quantity from the ingredient from the given slot in the storage.
      Specified by:
      extract in interface IIngredientComponentStorageSlotted<T,M>
      Parameters:
      slot - A slot number to extract from.
      maxQuantity - The maximum amount to extract.
      transaction - The transaction context.
      Returns:
      Ingredient extracted from the slot, must be IIngredientMatcher.getEmptyInstance(), if nothing can be extracted