Package alexiil.mc.lib.attributes.misc
Interface LimitedConsumer<T>
- All Known Subinterfaces:
FluidInsertable
,FluidTransferable
,GroupedFluidInv
,GroupedItemInv
,ItemInsertable
,ItemTransferable
,LimitedGroupedFluidInv
,LimitedGroupedItemInv
- All Known Implementing Classes:
CombinedFluidInsertable
,CombinedGroupedFluidInv
,CombinedGroupedItemInv
,CombinedItemInsertable
,DelegatingGroupedFluidInv
,DelegatingGroupedItemInv
,DirectFixedItemInv
,EmptyFluidTransferable
,EmptyGroupedFluidInv
,EmptyGroupedItemInv
,EmptyItemTransferable
,FilteredFluidInsertable
,FilteredFluidTransferable
,FilteredItemInsertable
,FilteredItemTransferable
,FullFixedItemInv
,GroupedFluidInvFixedWrapper
,GroupedItemInvFixedWrapper
,ItemBasedSingleFluidInv
,ItemTransferableItemEntity
,JumboFixedFluidInv
,RejectingFluidInsertable
,RejectingItemInsertable
,SimpleFixedFluidInv
,SimpleFixedFluidInvInsertable
,SimpleFixedItemInv
,SimpleFixedItemInvInsertable
,SimpleGroupedItemInv
,SimpleLimitedGroupedFluidInv
,SimpleLimitedGroupedItemInv
,SingleCopyingItemSlot
,SingleFluidTank
,SingleItemSlot
- 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 LimitedConsumer<T>
A type of
Consumer
that may or may not accept a given input.-
Method Summary
Modifier and Type Method Description static <T> LimitedConsumer<T>
fromConsumer(java.util.function.Consumer<T> consumer)
Creates a newLimitedConsumer
that accepts everything, and passes it on to the givenConsumer
.default boolean
offer(T object)
boolean
offer(T object, Simulation simulation)
static <T> LimitedConsumer<T>
rejecting()
default boolean
wouldAccept(T object)
-
Method Details
-
offer
- 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.simulation
- IfSimulation.ACTION
then this will modify state (if accepted).- Returns:
- True if the object would have been accepted.
-
offer
- 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
- 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.
-
rejecting
- Returns:
- A
LimitedConsumer
that rejects all inputs.
-
fromConsumer
Creates a newLimitedConsumer
that accepts everything, and passes it on to the givenConsumer
.
-