Interface IIngredientComponentStorageSlotted<T,M>
- Type Parameters:
T
- The instance type.M
- The matching condition parameter, may be Void. Instances MUST properly implement the equals method.
- All Superinterfaces:
IIngredientComponentStorage<T,
,M> Iterable<T>
- All Known Implementing Classes:
IngredientComponentStorageSlottedEmpty
,IngredientComponentStorageWrapperHandlerFluidStack.ComponentStorageWrapper
,IngredientComponentStorageWrapperHandlerItemStack.ComponentStorageWrapper
,IngredientComponentStorageWrapperHandlerItemStack.ComponentStorageWrapperCombined
A minimal slot-based storage for a type of ingredient component.
This is an extension of the slotless
IIngredientComponentStorage
.
The is interface defines no requirements on how instances must be stored internally.
For example, an implementing storage could combine internally several instances together
that are equal to each other and take the sum of their quantities.
This should not be used as a capability,
instead the IIngredientComponentStorageHandler
capability should be used,
as this can hold storage for different ingredient components.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionextract
(int slot, long maxQuantity, boolean simulate) Extract the at most the given quantity from the ingredient from the given slot in the storage.long
getMaxQuantity
(int slot) Get the maximum allowed quantity in the given slot.getSlotContents
(int slot) Get the ingredient that is contained in the given slot.int
getSlots()
Inserts an ingredient into the storage in the given slot and return the remainder.Methods inherited from interface org.cyclops.commoncapabilities.api.ingredient.storage.IIngredientComponentStorage
extract, extract, getComponent, getMaxQuantity, insert, iterator, iterator
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getSlots
int getSlots()- Returns:
- The number of available slots.
-
getSlotContents
Get the ingredient that is contained in the given slot. Note: The returned ingredient MUST NOT not be modified by the caller.- Parameters:
slot
- A slot number.- Returns:
- The contained ingredient.
-
getMaxQuantity
long getMaxQuantity(int slot) Get the maximum allowed quantity in the given slot.- Parameters:
slot
- A slot number.- Returns:
- The maximum allowed in the given slot.
-
insert
Inserts an ingredient into the storage in the given slot and return the remainder. The ingredient should not be modified in this function!- Parameters:
slot
- A slot number to insert to.ingredient
- Ingredient to insert.simulate
- If true, the insertion is only simulated.- 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
Extract the at most the given quantity from the ingredient from the given slot in the storage.- Parameters:
slot
- A slot number to extract from.maxQuantity
- The maximum amount to extract.simulate
- If true, the insertion is only simulated- Returns:
- Ingredient extracted from the slot, must be
IIngredientMatcher.getEmptyInstance()
, if nothing can be extracted
-