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 Details

    • attemptInsertion

      FluidVolume attemptInsertion​(FluidVolume fluid, Simulation simulation)
      Inserts the given stack into this insertable, and returns the excess.
      Parameters:
      fluid - The incoming fluid. Must not be modified by this call.
      simulation - If Simulation.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 default boolean offer​(FluidVolume fluid, Simulation simulation)
      Deprecated.
      This is an override for LimitedConsumer, for the full javadoc you probably want to call attemptInsertion(FluidVolume, Simulation) directly.
      Specified by:
      offer in interface LimitedConsumer<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 - If Simulation.ACTION then this will modify state (if accepted).
      Returns:
      True if the object would have been accepted.
    • offer

      @Deprecated default boolean offer​(FluidVolume object)
      Deprecated.
      This is an override for LimitedConsumer, for the full javadoc you probably want to call insert(FluidVolume) directly.
      Specified by:
      offer in interface LimitedConsumer<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 default boolean wouldAccept​(FluidVolume object)
      Deprecated.
      This is an override for LimitedConsumer, for the full javadoc you probably want to call attemptInsertion(FluidVolume, Simulation.SIMULATE) directly.
      Specified by:
      wouldAccept in interface LimitedConsumer<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

      default FluidVolume insert​(FluidVolume fluid)
      Inserts the given stack into this insertable, and returns the excess.

      This is equivalent to calling attemptInsertion(FluidVolume, Simulation) with a Simulation parameter of ACTION.

      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

      @Nullable default FluidAmount getMinimumAcceptedAmount()
      Returns:
      The minimum amount of fluid that attemptInsertion(FluidVolume, Simulation) will actually accept. Note that this only provides a guarantee that fluid volumes with an amount less than this will never be accepted.

      A null return value indicates that there is no minimum value.

    • getInsertionFilter

      default FluidFilter getInsertionFilter()
      Returns an FluidFilter to determine if attemptInsertion(FluidVolume, Simulation) could ever accept a fluid. The default implementation is to return ConstantFluidFilter.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

      default FluidInsertable filtered​(FluidFilter filter)
      Returns:
      A new FluidInsertable that has an additional filter applied to the fluid inserted into it.
    • getPureInsertable

      default FluidInsertable getPureInsertable()
      Returns:
      An object that only implements FluidInsertable, and does not expose any of the other modification methods that sibling or subclasses offer (like FluidExtractable or GroupedFluidInv.