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 FluidVolume
attemptAnyExtraction(int maxAmount, Simulation simulation)
Deprecated, for removal: This API element is subject to removal in a future version.default FluidVolume
attemptAnyExtraction(FluidAmount maxAmount, Simulation simulation)
default FluidVolume
attemptExtraction(FluidFilter filter, int maxAmount, Simulation simulation)
Deprecated.default FluidVolume
attemptExtraction(FluidFilter filter, FluidAmount maxAmount, Simulation simulation)
default boolean
default FluidVolume
extract(int maxAmount)
Deprecated, for removal: This API element is subject to removal in a future version.Replaced byextract(FluidAmount)
default FluidVolume
extract(FluidAmount maxAmount)
Attempt to extract *any*FluidVolume
from this.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)
.default FluidVolume
extract(FluidFilter filter, FluidAmount maxAmount)
default FluidVolume
Deprecated, for removal: This API element is subject to removal in a future version.Replaced byextract(FluidKey, FluidAmount)
default FluidVolume
extract(FluidKey filter, FluidAmount maxAmount)
default FluidExtractable
filtered(FluidFilter filter)
default FluidExtractable
static void
validateFluidExtractable(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.SIMULATE
then this should return the same result that the exact same call withSimulation.ACTION
would 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:
FluidExtractable
from = // Some extractable
FluidVolume
attempted = from.attemptAnyExtraction
(Integer.MAX_VALUE
,Simulation.SIMULATE
);
if (attempted.isEmpty()
) return;
FluidVolume
extracted = 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
FluidVolume
that 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.SIMULATE
then this should return the same result that the exact same call withSimulation.ACTION
would 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:
FluidExtractable
from = // Some extractable
FluidVolume
attempted = from.attemptAnyExtraction
(Integer.MAX_VALUE
,Simulation.SIMULATE
);
if (attempted.isEmpty()
) return;
FluidVolume
extracted = 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
FluidVolume
that 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*FluidVolume
from this thatmatches
the givenFluidFilter
.This is equivalent to calling
attemptExtraction(FluidFilter, int, Simulation)
with aSimulation
parameter ofACTION
.- Parameters:
maxAmount
- The maximum number of items that can be extracted. Negative numbers throw an exception.- Returns:
- A new, independent
ItemStack
that was extracted.
-
extract
Attempt to extract *any*FluidVolume
from this thatmatches
the givenFluidFilter
.This is equivalent to calling
attemptExtraction(FluidFilter, int, Simulation)
with aSimulation
parameter ofACTION
.- Parameters:
maxAmount
- The maximum number of items that can be extracted. Negative numbers throw an exception.- Returns:
- A new, independent
ItemStack
that 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*FluidVolume
from this that isequal
to the givenItemStack
.This is equivalent to calling
attemptExtraction(FluidFilter, int, Simulation)
with anFluidFilter
parameter ofExactFluidFilter
and aSimulation
parameter ofACTION
.- Parameters:
maxAmount
- The maximum number of items that can be extracted. Negative numbers throw an exception.- Returns:
- A new, independent
ItemStack
that was extracted.
-
extract
Attempt to extract *any*FluidVolume
from this that isequal
to the givenItemStack
.This is equivalent to calling
attemptExtraction(FluidFilter, int, Simulation)
with anFluidFilter
parameter ofExactFluidFilter
and aSimulation
parameter ofACTION
.- Parameters:
maxAmount
- The maximum number of items that can be extracted. Negative numbers throw an exception.- Returns:
- A new, independent
ItemStack
that was extracted.
-
extract
Deprecated, for removal: This API element is subject to removal in a future version.Replaced byextract(FluidAmount)
Attempt to extract *any*FluidVolume
from this.This is equivalent to calling
attemptExtraction(FluidFilter, int, Simulation)
with anFluidFilter
parameter ofConstantFluidFilter.ANYTHING
and aSimulation
parameter ofACTION
.- Parameters:
maxAmount
- The maximum number of items that can be extracted. Negative numbers throw an exception.- Returns:
- A new, independent
ItemStack
that was extracted.
-
extract
Attempt to extract *any*FluidVolume
from this.This is equivalent to calling
attemptExtraction(FluidFilter, int, Simulation)
with anFluidFilter
parameter ofConstantFluidFilter.ANYTHING
and aSimulation
parameter ofACTION
.- Parameters:
maxAmount
- The maximum number of items that can be extracted. Negative numbers throw an exception.- Returns:
- A new, independent
ItemStack
that was extracted.
-
couldExtractAnything
default boolean couldExtractAnything()- Returns:
- True if
attemptAnyExtraction
(FluidAmount.ONE, SIMULATE) returns a non-emptyFluidVolume
.
-
validateFluidExtractable
-
filtered
- Returns:
- A new
FluidExtractable
that 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 (likeFluidInsertable
orGroupedFluidInv
.
-
attemptAnyExtraction(FluidAmount, Simulation)