Class IngredientComponentStorageWrapperHandlerFluidStack.ComponentStorageWrapper
java.lang.Object
org.cyclops.commoncapabilities.ingredient.storage.IngredientComponentStorageWrapperHandlerFluidStack.ComponentStorageWrapper
- All Implemented Interfaces:
Iterable<net.neoforged.neoforge.fluids.FluidStack>,IIngredientComponentStorage<net.neoforged.neoforge.fluids.FluidStack,,Integer> IIngredientComponentStorageSlotted<net.neoforged.neoforge.fluids.FluidStack,Integer>
- Enclosing class:
IngredientComponentStorageWrapperHandlerFluidStack<C>
public static class IngredientComponentStorageWrapperHandlerFluidStack.ComponentStorageWrapper
extends Object
implements IIngredientComponentStorageSlotted<net.neoforged.neoforge.fluids.FluidStack,Integer>
-
Constructor Summary
ConstructorsConstructorDescriptionComponentStorageWrapper(IngredientComponent<net.neoforged.neoforge.fluids.FluidStack, Integer> ingredientComponent, net.neoforged.neoforge.fluids.capability.IFluidHandler storage) -
Method Summary
Modifier and TypeMethodDescriptionnet.neoforged.neoforge.fluids.FluidStackextract(int slot, long maxQuantity, boolean simulate) Extract the at most the given quantity from the ingredient from the given slot in the storage.net.neoforged.neoforge.fluids.FluidStackextract(long maxQuantity, boolean simulate) Extract any ingredient, but the given maximum amount from the storage.net.neoforged.neoforge.fluids.FluidStackExtract an ingredient matching the given prototype from the storage.IngredientComponent<net.neoforged.neoforge.fluids.FluidStack, Integer> longlonggetMaxQuantity(int slot) Get the maximum allowed quantity in the given slot.net.neoforged.neoforge.fluids.FluidStackgetSlotContents(int slot) Get the ingredient that is contained in the given slot.intgetSlots()net.neoforged.neoforge.fluids.FluidStackinsert(int slot, net.neoforged.neoforge.fluids.FluidStack ingredient, boolean simulate) Inserts an ingredient into the storage in the given slot and return the remainder.net.neoforged.neoforge.fluids.FluidStackinsert(net.neoforged.neoforge.fluids.FluidStack ingredient, boolean simulate) Inserts an ingredient into the storage and return the remainder.Iterator<net.neoforged.neoforge.fluids.FluidStack> iterator()Get all ingredients in this storage.Iterator<net.neoforged.neoforge.fluids.FluidStack> Find all ingredients matching the given prototype from the storage.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ComponentStorageWrapper
public ComponentStorageWrapper(IngredientComponent<net.neoforged.neoforge.fluids.FluidStack, Integer> ingredientComponent, net.neoforged.neoforge.fluids.capability.IFluidHandler storage)
-
-
Method Details
-
getComponent
- Specified by:
getComponentin interfaceIIngredientComponentStorage<net.neoforged.neoforge.fluids.FluidStack,Integer> - Returns:
- The ingredient component type this storage applies to.
-
iterator
Description copied from interface:IIngredientComponentStorageGet all ingredients in this storage.- Specified by:
iteratorin interfaceIIngredientComponentStorage<net.neoforged.neoforge.fluids.FluidStack,Integer> - Specified by:
iteratorin interfaceIterable<net.neoforged.neoforge.fluids.FluidStack>- Returns:
- An iterator over all available ingredients in this storage.
-
iterator
public Iterator<net.neoforged.neoforge.fluids.FluidStack> iterator(@Nonnull net.neoforged.neoforge.fluids.FluidStack prototype, Integer matchFlags) Description copied from interface:IIngredientComponentStorageFind all ingredients matching the given prototype from the storage. Calling this method will not modify the storage in any way. Results from this method MUST NOT be modified.- Specified by:
iteratorin interfaceIIngredientComponentStorage<net.neoforged.neoforge.fluids.FluidStack,Integer> - Parameters:
prototype- The ingredient to search for.matchFlags- The flags to compare the given prototype by according toIngredientComponent.getMatcher().- Returns:
- An iterator over ingredients that match the given prototype, which may potentially be empty.
-
getMaxQuantity
public long getMaxQuantity()- Specified by:
getMaxQuantityin interfaceIIngredientComponentStorage<net.neoforged.neoforge.fluids.FluidStack,Integer> - Returns:
- The maximum allowed quantity over all instances.
-
insert
public net.neoforged.neoforge.fluids.FluidStack insert(@Nonnull net.neoforged.neoforge.fluids.FluidStack ingredient, boolean simulate) Description copied from interface:IIngredientComponentStorageInserts an ingredient into the storage and return the remainder. The ingredient should not be modified in this function!- Specified by:
insertin interfaceIIngredientComponentStorage<net.neoforged.neoforge.fluids.FluidStack,Integer> - Parameters:
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
public net.neoforged.neoforge.fluids.FluidStack extract(@Nonnull net.neoforged.neoforge.fluids.FluidStack prototype, Integer matchFlags, boolean simulate) Description copied from interface:IIngredientComponentStorageExtract an ingredient matching the given prototype from the storage. Note that only the extracted ingredient must match the prototype under the given condition. Internally, ingredients can be combined and matched in any way. For example, an exact match could be produced by combining several ingredients. If the primary quantifier (as identified byIngredientComponent.getPrimaryQuantifier()) IS NOT part of the match condition, then the quantity of the given prototype MUST be interpreted as the maximum quantity that must be extracted. If the primary quantifier (as identified byIngredientComponent.getPrimaryQuantifier()) IS part of the match condition, then the quantity of the given prototype MUST be interpreted as the exact quantity that must be extracted. If the storage has a HIGHER OR EQUAL available quantity, then the storage MUST allow the given quantity to be extracted. If the storage on the other hand has a LOWER available quantity, then extraction is not allowed.- Specified by:
extractin interfaceIIngredientComponentStorage<net.neoforged.neoforge.fluids.FluidStack,Integer> - Parameters:
prototype- The ingredient to search for.matchFlags- The flags to compare the given prototype by according toIngredientComponent.getMatcher().simulate- If true, the insertion is only simulated- Returns:
- Ingredient extracted from the slot, must be
IIngredientMatcher.getEmptyInstance(), if nothing can be extracted
-
extract
public net.neoforged.neoforge.fluids.FluidStack extract(long maxQuantity, boolean simulate) Description copied from interface:IIngredientComponentStorageExtract any ingredient, but the given maximum amount from the storage.- Specified by:
extractin interfaceIIngredientComponentStorage<net.neoforged.neoforge.fluids.FluidStack,Integer> - Parameters:
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
-
getSlots
public int getSlots()- Specified by:
getSlotsin interfaceIIngredientComponentStorageSlotted<net.neoforged.neoforge.fluids.FluidStack,Integer> - Returns:
- The number of available slots.
-
getSlotContents
public net.neoforged.neoforge.fluids.FluidStack getSlotContents(int slot) Description copied from interface:IIngredientComponentStorageSlottedGet the ingredient that is contained in the given slot. Note: The returned ingredient MUST NOT not be modified by the caller.- Specified by:
getSlotContentsin interfaceIIngredientComponentStorageSlotted<net.neoforged.neoforge.fluids.FluidStack,Integer> - Parameters:
slot- A slot number.- Returns:
- The contained ingredient.
-
getMaxQuantity
public long getMaxQuantity(int slot) Description copied from interface:IIngredientComponentStorageSlottedGet the maximum allowed quantity in the given slot.- Specified by:
getMaxQuantityin interfaceIIngredientComponentStorageSlotted<net.neoforged.neoforge.fluids.FluidStack,Integer> - Parameters:
slot- A slot number.- Returns:
- The maximum allowed in the given slot.
-
insert
public net.neoforged.neoforge.fluids.FluidStack insert(int slot, @Nonnull net.neoforged.neoforge.fluids.FluidStack ingredient, boolean simulate) Description copied from interface:IIngredientComponentStorageSlottedInserts an ingredient into the storage in the given slot and return the remainder. The ingredient should not be modified in this function!- Specified by:
insertin interfaceIIngredientComponentStorageSlotted<net.neoforged.neoforge.fluids.FluidStack,Integer> - 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
public net.neoforged.neoforge.fluids.FluidStack extract(int slot, long maxQuantity, boolean simulate) Description copied from interface:IIngredientComponentStorageSlottedExtract the at most the given quantity from the ingredient from the given slot in the storage.- Specified by:
extractin interfaceIIngredientComponentStorageSlotted<net.neoforged.neoforge.fluids.FluidStack,Integer> - 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
-