Interface ItemFilter

All Known Subinterfaces:
ReadableItemFilter, ResolvableItemFilter
All Known Implementing Classes:
AggregateItemFilter, ConstantItemFilter, ExactItemFilter, ExactItemSetFilter, ExactItemStackFilter, InvertedItemFilter, ItemClassFilter, ItemInsertableFilter, ItemTagFilter
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 ItemFilter
A specialised version of the Predicate functional interface for ItemStacks.

5 basic implementations are provided:

  • Method Details

    • matches

      boolean matches(net.minecraft.item.ItemStack stack)
      Checks to see if this filter matches the given stack. Note that this must not care about ItemStack.getCount(), except in the case where the stack is ItemStack.isEmpty(), which isn't expected to return a useful result.
    • negate

      default ItemFilter negate()
    • and

      default ItemFilter and(ItemFilter other)
    • or

      default ItemFilter or(ItemFilter other)
    • asPredicate

      default Predicate<net.minecraft.item.ItemStack> asPredicate()
      Returns:
      A Predicate that delegates to this matches(ItemStack). The default implementation returns ItemFilter.ItemFilterAsPredicate, which is probably always what you want.