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
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
Modifier and TypeMethodDescriptiondefault FluidVolumeattemptAnyExtraction(int maxAmount, Simulation simulation) Deprecated, for removal: This API element is subject to removal in a future version.default FluidVolumeattemptAnyExtraction(FluidAmount maxAmount, Simulation simulation) default FluidVolumeattemptExtraction(FluidFilter filter, int maxAmount, Simulation simulation) Deprecated.default FluidVolumeattemptExtraction(FluidFilter filter, FluidAmount maxAmount, Simulation simulation) default booleandefault FluidVolumeextract(int maxAmount) Deprecated, for removal: This API element is subject to removal in a future version.Replaced byextract(FluidAmount)default FluidVolumeextract(FluidAmount maxAmount) Attempt to extract *any*FluidVolumefrom this.default FluidVolumeextract(FluidFilter filter, int maxAmount) Deprecated, for removal: This API element is subject to removal in a future version.Replaced byextract(FluidFilter, FluidAmount).default FluidVolumeextract(FluidFilter filter, FluidAmount maxAmount) default FluidVolumeDeprecated, for removal: This API element is subject to removal in a future version.Replaced byextract(FluidKey, FluidAmount)default FluidVolumeextract(FluidKey filter, FluidAmount maxAmount) default FluidExtractablefiltered(FluidFilter filter) default FluidExtractablestatic voidvalidateFluidExtractable(FluidExtractable instance)
-
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(since="0.6.0", forRemoval=true) default FluidVolume attemptAnyExtraction(int maxAmount, Simulation simulation) Deprecated, for removal: This API element is subject to removal in a future version.Replaced byattemptAnyExtraction(FluidAmount, Simulation) -
attemptAnyExtraction
-
extract
@Deprecated(since="0.6.0", forRemoval=true) default FluidVolume extract(FluidFilter filter, int maxAmount) Deprecated, for removal: This API element is subject to removal in a future version.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(since="0.6.0", forRemoval=true) default FluidVolume extract(FluidKey filter, int maxAmount) Deprecated, for removal: This API element is subject to removal in a future version.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, for removal: This API element is subject to removal in a future version.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.
-
attemptAnyExtraction(FluidAmount, Simulation)