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.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.Replaced byattemptAnyExtraction(FluidAmount, Simulation)
-
attemptAnyExtraction
-
extract
Deprecated.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.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.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
.
-