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.
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)).-
Nested Class Summary
Nested classes/interfaces inherited from interface alexiil.mc.lib.attributes.item.filter.ItemFilter
ItemFilter.ItemFilterAsPredicate
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
matches(net.minecraft.item.ItemStack stack)
Checks to see if this filter matches the given stack.resolve()
Resolves thisReadableItemFilter
.Methods inherited from interface alexiil.mc.lib.attributes.item.filter.ItemFilter
and, asPredicate, negate, or
-
Method Details
-
resolve
ReadableItemFilter resolve()Resolves thisReadableItemFilter
. Note that this must return one of the valid types ofReadableItemFilter
, 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 aboutItemStack.getCount()
, except in the case where the stack isItemStack.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 interfaceItemFilter
-