Interface InventoryUtility.ItemStackExtractor
-
- Enclosing class:
- InventoryUtility
public static interface InventoryUtility.ItemStackExtractor
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classInventoryUtility.ItemStackExtractor.APIType
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static InventoryUtility.ItemStackExtractorcreateOnlyOptimized(InventoryUtility.OptimizedExtractor optimizedExtractor)default intgetItem(ItemStack source, ItemStack toExtract, boolean simulate, EntityPlayerMP player)Extract a particular type of item.booleanisAPIImplemented(InventoryUtility.ItemStackExtractor.APIType type)default booleanisValidSource(ItemStack is, EntityPlayerMP player)inttakeFromStack(java.util.function.Predicate<ItemStack> predicate, boolean simulate, int count, InventoryUtility.ItemStackCounter store, ItemStack source, ItemStack filter, EntityPlayerMP player)Extract a particular type of item.
-
-
-
Method Detail
-
isAPIImplemented
boolean isAPIImplemented(InventoryUtility.ItemStackExtractor.APIType type)
-
isValidSource
default boolean isValidSource(ItemStack is, EntityPlayerMP player)
-
takeFromStack
int takeFromStack(java.util.function.Predicate<ItemStack> predicate, boolean simulate, int count, InventoryUtility.ItemStackCounter store, ItemStack source, ItemStack filter, EntityPlayerMP player)
Extract a particular type of item. The extractor can choose to not return all items contained within this item as long as it makes sense, but the author should inform the player of this.Whether this method does recursive extraction is at the discretion of implementor.
- Parameters:
predicate- the main filtering predicate. never null. It's assumed predicate always returns true on filter, if that is not nullstore- where to store extracted items. Should increment thesource- from where an extraction should be attemptedfilter- stack to extract. should not be mutated! match the NBT tag using EXACT mode. might be null.simulate- true if only query but does not actually removeplayer- executor of extraction, or null if from a machine- Returns:
- amount extracted, or -1 if this is not implemented
-
getItem
default int getItem(ItemStack source, ItemStack toExtract, boolean simulate, EntityPlayerMP player)
Extract a particular type of item. The extractor can choose to not return all items contained within this item as long as it makes sense, but the author should inform the player of this.Whether this method does recursive extraction is at the discretion of implementor.
- Parameters:
source- from where an extraction should be attemptedtoExtract- stack to extract. should not be mutated! match the NBT tag using EXACT mode.simulate- true if only query but does not actually removeplayer- executor of extraction, or null if from a machine- Returns:
- amount extracted, or -1 if this is not implemented
-
createOnlyOptimized
static InventoryUtility.ItemStackExtractor createOnlyOptimized(@Nonnull InventoryUtility.OptimizedExtractor optimizedExtractor)
-
-