Package alexiil.mc.lib.attributes.item
Interface ItemExtractable
- All Known Subinterfaces:
GroupedItemInv
,ItemTransferable
,LimitedGroupedItemInv
- All Known Implementing Classes:
CombinedGroupedItemInv
,CombinedItemExtractable
,DelegatingGroupedItemInv
,DirectFixedItemInv
,EmptyGroupedItemInv
,EmptyItemExtractable
,EmptyItemTransferable
,FilteredItemExtractable
,FilteredItemTransferable
,FullFixedItemInv
,GroupedItemInvFixedWrapper
,ItemExtractableProjectileEntity
,ItemTransferableItemEntity
,SimpleFixedItemInv
,SimpleFixedItemInvExtractable
,SimpleGroupedItemInv
,SimpleLimitedGroupedItemInv
,SingleCopyingItemSlot
,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 ItemExtractable
Defines an object that can have items extracted from it.
-
Method Summary
Modifier and Type Method Description default net.minecraft.item.ItemStack
attemptAnyExtraction(int maxAmount, Simulation simulation)
net.minecraft.item.ItemStack
attemptExtraction(ItemFilter filter, int maxAmount, Simulation simulation)
default boolean
couldExtractAnything()
default net.minecraft.item.ItemStack
extract(int maxAmount)
Attempt to extract *any*ItemStack
from this.default net.minecraft.item.ItemStack
extract(ItemFilter filter, int maxAmount)
default net.minecraft.item.ItemStack
extract(net.minecraft.item.ItemStack filter, int maxAmount)
default ItemExtractable
filtered(ItemFilter filter)
default ItemExtractable
getPureExtractable()
-
Method Details
-
attemptExtraction
net.minecraft.item.ItemStack attemptExtraction(ItemFilter filter, int maxAmount, Simulation simulation)- Parameters:
maxAmount
- The maximum number of items that can be extracted. Negative numbers throw an exception.simulation
- IfSimulation.SIMULATE
then this should return the same result that a call withSimulation.ACTION
would do, but without modifying anything else.- Returns:
- A new, independent
ItemStack
that was extracted.
-
attemptAnyExtraction
-
extract
Attempt to extract *any*ItemStack
from this thatmatches
the givenItemFilter
.This is equivalent to calling
attemptExtraction(ItemFilter, 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
default net.minecraft.item.ItemStack extract(net.minecraft.item.ItemStack filter, int maxAmount)Attempt to extract *any*ItemStack
from this that isequal
to the givenItemStack
.This is equivalent to calling
attemptExtraction(ItemFilter, int, Simulation)
with anItemFilter
parameter ofExactItemStackFilter
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
default net.minecraft.item.ItemStack extract(int maxAmount)Attempt to extract *any*ItemStack
from this.This is equivalent to calling
attemptExtraction(ItemFilter, int, Simulation)
with anItemFilter
parameter ofConstantItemFilter.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
(1, SIMULATE) returns a non-emptyItemStack
.
-
filtered
- Returns:
- A new
ItemExtractable
that has an additional filter applied to limit the items extracted from it.
-
getPureExtractable
- Returns:
- An object that only implements
ItemExtractable
, and does not expose any of the other modification methods that sibling or subclasses offer (likeItemInsertable
orGroupedItemInv
.
-