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 Details

    • attemptExtraction

      net.minecraft.item.ItemStack attemptExtraction(ItemFilter filter, int maxAmount, Simulation simulation)
      Attempt to extract *any* ItemStack from this that matches the given ItemFilter.
      Parameters:
      maxAmount - The maximum number of items that can be extracted. Negative numbers throw an exception.
      simulation - If Simulation.SIMULATE then this should return the same result that a call with Simulation.ACTION would do, but without modifying anything else.
      Returns:
      A new, independent ItemStack that was extracted.
    • attemptAnyExtraction

      default net.minecraft.item.ItemStack attemptAnyExtraction(int maxAmount, Simulation simulation)
    • extract

      default net.minecraft.item.ItemStack extract(ItemFilter filter, int maxAmount)
      Attempt to extract *any* ItemStack from this that matches the given ItemFilter.

      This is equivalent to calling attemptExtraction(ItemFilter, int, Simulation) with a Simulation parameter of ACTION.

      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 is equalto the given ItemStack.

      This is equivalent to calling attemptExtraction(ItemFilter, int, Simulation) with an ItemFilter parameter of ExactItemStackFilter and a Simulation parameter of ACTION.

      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 an ItemFilter parameter of ConstantItemFilter.ANYTHING and a Simulation parameter of ACTION.

      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-empty ItemStack.
    • filtered

      default ItemExtractable filtered(ItemFilter filter)
      Returns:
      A new ItemExtractable that has an additional filter applied to limit the items extracted from it.
    • getPureExtractable

      default ItemExtractable getPureExtractable()
      Returns:
      An object that only implements ItemExtractable, and does not expose any of the other modification methods that sibling or subclasses offer (like ItemInsertable or GroupedItemInv.