Interface ResolvableItemFilter

All Superinterfaces:
ItemFilter, ReadableItemFilter
All Known Implementing Classes:
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 ResolvableItemFilter extends ReadableItemFilter
A type of ReadableItemFilter that may be resolved at a later time to a fixed ReadableItemFilter, but which isn't constant over time. (For example item tags may be reloaded, but are stored in a static field and so don't need to be re-created often. (And can be read)).
  • Method Details

    • resolve

      Resolves this ReadableItemFilter. Note that this must return one of the valid types of ReadableItemFilter, except this!

      This is intended for use-cases where you actually need to read the filter - for other cases there's usually little reason to call this, as "matches" should be faster for most reasonable implementations. (However some implementations - for example lambdas - might be faster to call multiple times if you resolve them before checking them).

    • matches

      default 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.

      This is overridden primarily for lambdas - most implementing classes are expected to override this, because it will most likely be faster.

      Specified by:
      matches in interface ItemFilter