Interface FluidExtractable
- All Known Subinterfaces:
FluidTransferable,GroupedFluidInv,LimitedGroupedFluidInv
- All Known Implementing Classes:
CombinedFluidExtractable,CombinedGroupedFluidInv,DelegatingGroupedFluidInv,EmptyFluidExtractable,EmptyFluidTransferable,EmptyGroupedFluidInv,FilteredFluidExtractable,FilteredFluidTransferable,GroupedFluidInvFixedWrapper,ItemBasedSingleFluidInv,JumboFixedFluidInv,SimpleFixedFluidInv,SimpleFixedFluidInvExtractable,SimpleLimitedGroupedFluidInv,SingleFluidTank
public interface FluidExtractable
As of 0.6 implementations must override either attemptExtraction(FluidFilter, FluidAmount, Simulation) or
attemptExtraction(FluidFilter, int, Simulation), as both implementations call each other by default.
-
Method Summary
-
Method Details
-
attemptExtraction
Deprecated.- Parameters:
filter-maxAmount- The maximum amount of fluid that can be extracted. Negative numbers throw an exception.simulation- IfSimulation.SIMULATEthen this should return the same result that the exact same call withSimulation.ACTIONwould do, except that the filter can be made more specific between calls if the previously simulated extracted fluid is used as a filter.For example the following code snippet should never throw an exception:
FluidExtractablefrom = // Some extractable
FluidVolumeattempted = from.attemptAnyExtraction(Integer.MAX_VALUE,Simulation.SIMULATE);
if (attempted.isEmpty()) return;
FluidVolumeextracted = from.extract(attempted.getFluidKey(), attempted.getAmount());
assert !extracted.isEmpty;
assert attempted.getAmount()== extracted.getAmount();
assert attempted.getFluidKet()== extracted.getFluidKet();
assert attempted.equals(extracted);- Returns:
- A new, independent
FluidVolumethat was extracted.
-
attemptExtraction
default FluidVolume attemptExtraction(FluidFilter filter, FluidAmount maxAmount, Simulation simulation)- Parameters:
filter-maxAmount- The maximum amount of fluid that can be extracted. Negative numbers throw an exception.simulation- IfSimulation.SIMULATEthen this should return the same result that the exact same call withSimulation.ACTIONwould do, except that the filter can be made more specific between calls if the previously simulated extracted fluid is used as a filter.For example the following code snippet should never throw an exception:
FluidExtractablefrom = // Some extractable
FluidVolumeattempted = from.attemptAnyExtraction(Integer.MAX_VALUE,Simulation.SIMULATE);
if (attempted.isEmpty()) return;
FluidVolumeextracted = from.extract(attempted.getFluidKey(), attempted.getAmount());
assert !extracted.isEmpty;
assert attempted.getAmount()== extracted.getAmount();
assert attempted.getFluidKet()== extracted.getFluidKet();
assert attempted.equals(extracted);- Returns:
- A new, independent
FluidVolumethat was extracted.
-
attemptAnyExtraction
Deprecated.Replaced byattemptAnyExtraction(FluidAmount, Simulation) -
attemptAnyExtraction
-
extract
Deprecated.Replaced byextract(FluidFilter, FluidAmount).Attempt to extract *any*FluidVolumefrom this thatmatchesthe givenFluidFilter.This is equivalent to calling
attemptExtraction(FluidFilter, int, Simulation)with aSimulationparameter ofACTION.- Parameters:
maxAmount- The maximum number of items that can be extracted. Negative numbers throw an exception.- Returns:
- A new, independent
ItemStackthat was extracted.
-
extract
Attempt to extract *any*FluidVolumefrom this thatmatchesthe givenFluidFilter.This is equivalent to calling
attemptExtraction(FluidFilter, int, Simulation)with aSimulationparameter ofACTION.- Parameters:
maxAmount- The maximum number of items that can be extracted. Negative numbers throw an exception.- Returns:
- A new, independent
ItemStackthat was extracted.
-
extract
Deprecated.Replaced byextract(FluidKey, FluidAmount)Attempt to extract *any*FluidVolumefrom this that isequalto the givenItemStack.This is equivalent to calling
attemptExtraction(FluidFilter, int, Simulation)with anFluidFilterparameter ofExactFluidFilterand aSimulationparameter ofACTION.- Parameters:
maxAmount- The maximum number of items that can be extracted. Negative numbers throw an exception.- Returns:
- A new, independent
ItemStackthat was extracted.
-
extract
Attempt to extract *any*FluidVolumefrom this that isequalto the givenItemStack.This is equivalent to calling
attemptExtraction(FluidFilter, int, Simulation)with anFluidFilterparameter ofExactFluidFilterand aSimulationparameter ofACTION.- Parameters:
maxAmount- The maximum number of items that can be extracted. Negative numbers throw an exception.- Returns:
- A new, independent
ItemStackthat was extracted.
-
extract
Deprecated.Replaced byextract(FluidAmount)Attempt to extract *any*FluidVolumefrom this.This is equivalent to calling
attemptExtraction(FluidFilter, int, Simulation)with anFluidFilterparameter ofConstantFluidFilter.ANYTHINGand aSimulationparameter ofACTION.- Parameters:
maxAmount- The maximum number of items that can be extracted. Negative numbers throw an exception.- Returns:
- A new, independent
ItemStackthat was extracted.
-
extract
Attempt to extract *any*FluidVolumefrom this.This is equivalent to calling
attemptExtraction(FluidFilter, int, Simulation)with anFluidFilterparameter ofConstantFluidFilter.ANYTHINGand aSimulationparameter ofACTION.- Parameters:
maxAmount- The maximum number of items that can be extracted. Negative numbers throw an exception.- Returns:
- A new, independent
ItemStackthat was extracted.
-
couldExtractAnything
default boolean couldExtractAnything()- Returns:
- True if
attemptAnyExtraction(FluidAmount.ONE, SIMULATE) returns a non-emptyFluidVolume.
-
validateFluidExtractable
-
filtered
- Returns:
- A new
FluidExtractablethat has an additional filter applied to limit the fluid extracted from it.
-
getPureExtractable
- Returns:
- An object that only implements
FluidExtractable, and does not expose any of the other modification methods that sibling or subclasses offer (likeFluidInsertableorGroupedFluidInv.
-