Package alexiil.mc.lib.attributes.fluid
Interface FluidInsertable
- All Superinterfaces:
LimitedConsumer<FluidVolume>
- All Known Subinterfaces:
FluidTransferable
,GroupedFluidInv
,LimitedGroupedFluidInv
- All Known Implementing Classes:
CombinedFluidInsertable
,CombinedGroupedFluidInv
,DelegatingGroupedFluidInv
,EmptyFluidTransferable
,EmptyGroupedFluidInv
,FilteredFluidInsertable
,FilteredFluidTransferable
,GroupedFluidInvFixedWrapper
,ItemBasedSingleFluidInv
,JumboFixedFluidInv
,RejectingFluidInsertable
,SimpleFixedFluidInv
,SimpleFixedFluidInvInsertable
,SimpleLimitedGroupedFluidInv
,SingleFluidTank
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface FluidInsertable extends LimitedConsumer<FluidVolume>
Defines an object that can have fluids inserted into it.
-
Method Summary
Modifier and Type Method Description FluidVolume
attemptInsertion(FluidVolume fluid, Simulation simulation)
Inserts the given stack into this insertable, and returns the excess.default FluidInsertable
filtered(FluidFilter filter)
default FluidFilter
getInsertionFilter()
Returns anFluidFilter
to determine ifattemptInsertion(FluidVolume, Simulation)
could ever accept a fluid.default FluidAmount
getMinimumAcceptedAmount()
default FluidInsertable
getPureInsertable()
default FluidVolume
insert(FluidVolume fluid)
Inserts the given stack into this insertable, and returns the excess.default boolean
offer(FluidVolume object)
Deprecated.This is an override forLimitedConsumer
, for the full javadoc you probably want to callinsert(FluidVolume)
directly.default boolean
offer(FluidVolume fluid, Simulation simulation)
Deprecated.This is an override forLimitedConsumer
, for the full javadoc you probably want to callattemptInsertion(FluidVolume, Simulation)
directly.default boolean
wouldAccept(FluidVolume object)
Deprecated.This is an override forLimitedConsumer
, for the full javadoc you probably want to callattemptInsertion
(FluidVolume, Simulation.SIMULATE) directly.
-
Method Details
-
attemptInsertion
Inserts the given stack into this insertable, and returns the excess.- Parameters:
fluid
- The incoming fluid. Must not be modified by this call.simulation
- IfSimulation.SIMULATE
then this shouldn't modify anything.- Returns:
- the excess
FluidVolume
that wasn't accepted. This will be independent of this insertable, however it might be the given object instead of a completely new object.
-
offer
Deprecated.This is an override forLimitedConsumer
, for the full javadoc you probably want to callattemptInsertion(FluidVolume, Simulation)
directly.- Specified by:
offer
in interfaceLimitedConsumer<FluidVolume>
- Parameters:
fluid
- The object to offer. This interface makes no guarantees about whether this object will be defensively copied or not - so callers should assume that any objects passed to this may be modified in any way. Likewise, this has no requirements for what callers may do with the object after it has been passed in.simulation
- IfSimulation.ACTION
then this will modify state (if accepted).- Returns:
- True if the object would have been accepted.
-
offer
Deprecated.This is an override forLimitedConsumer
, for the full javadoc you probably want to callinsert(FluidVolume)
directly.- Specified by:
offer
in interfaceLimitedConsumer<FluidVolume>
- Parameters:
object
- The object to offer. This interface makes no guarantees about whether this object will be defensively copied or not - so callers should assume that any objects passed to this may be modified in any way. Likewise, this has no requirements for what callers may do with the object after it has been passed in- Returns:
- True if the offer was accepted, or false if nothing happened.
-
wouldAccept
Deprecated.This is an override forLimitedConsumer
, for the full javadoc you probably want to callattemptInsertion
(FluidVolume, Simulation.SIMULATE) directly.- Specified by:
wouldAccept
in interfaceLimitedConsumer<FluidVolume>
- Parameters:
object
- The object to test for. This interface makes no guarantees about whether this object will be defensively copied or not - so callers should assume that any objects passed to this may be modified in any way. Likewise, this has no requirements for what callers may do with the object after it has been passed in- Returns:
- True if the offer was accepted, or false if nothing happened.
-
insert
Inserts the given stack into this insertable, and returns the excess.This is equivalent to calling
attemptInsertion(FluidVolume, Simulation)
with aSimulation
parameter ofACTION
.- Parameters:
fluid
- The incoming fluid. Must not be modified by this call.- Returns:
- the excess
FluidVolume
that wasn't accepted. This will be independent of this insertable, however it might be the given stack instead of a completely new object.
-
getMinimumAcceptedAmount
- Returns:
- The minimum amount of fluid that
attemptInsertion(FluidVolume, Simulation)
will actually accept. Note that this only provides a guarantee thatfluid volumes
with anamount
less than this will never be accepted.A null return value indicates that there is no minimum value.
-
getInsertionFilter
Returns anFluidFilter
to determine ifattemptInsertion(FluidVolume, Simulation)
could ever accept a fluid. The default implementation is to returnConstantFluidFilter.ANYTHING
, and so it is recommended that custom insertables override this to return a more accurate filter.- Returns:
- A filter to determine if the given fluid could ever be inserted.
-
filtered
- Returns:
- A new
FluidInsertable
that has an additional filter applied to the fluid inserted into it.
-
getPureInsertable
- Returns:
- An object that only implements
FluidInsertable
, and does not expose any of the other modification methods that sibling or subclasses offer (likeFluidExtractable
orGroupedFluidInv
.
-