Class ExactItemFilter

java.lang.Object
alexiil.mc.lib.attributes.item.filter.ExactItemFilter
All Implemented Interfaces:
ItemFilter, ReadableItemFilter

public final class ExactItemFilter
extends java.lang.Object
implements ReadableItemFilter
An ItemFilter that only matches on a single Item.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface alexiil.mc.lib.attributes.item.filter.ItemFilter

    ItemFilter.ItemFilterAsPredicate
  • Field Summary

    Fields 
    Modifier and Type Field Description
    net.minecraft.item.Item item  
  • Constructor Summary

    Constructors 
    Constructor Description
    ExactItemFilter​(net.minecraft.item.Item item)  
  • Method Summary

    Modifier and Type Method Description
    static ReadableItemFilter anyOf​(java.util.Collection<? extends net.minecraft.item.ItemConvertible> items)  
    static ReadableItemFilter anyOf​(net.minecraft.item.ItemConvertible[] items)  
    static ReadableItemFilter createFilter​(net.minecraft.item.ItemConvertible entry)  
    boolean matches​(net.minecraft.item.ItemStack stack)
    Checks to see if this filter matches the given stack.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface alexiil.mc.lib.attributes.item.filter.ItemFilter

    and, asPredicate, negate, or
  • Field Details

    • item

      public final net.minecraft.item.Item item
  • Constructor Details

    • ExactItemFilter

      public ExactItemFilter​(net.minecraft.item.Item item)
  • Method Details

    • createFilter

      public static ReadableItemFilter createFilter​(net.minecraft.item.ItemConvertible entry)
      Returns:
      Either ConstantItemFilter.NOTHING if ItemConvertible.asItem() returns Items.AIR, or an ExactItemFilter if it returns any other Item.
    • anyOf

      public static ReadableItemFilter anyOf​(java.util.Collection<? extends net.minecraft.item.ItemConvertible> items)
    • anyOf

      public static ReadableItemFilter anyOf​(net.minecraft.item.ItemConvertible[] items)
    • matches

      public boolean matches​(net.minecraft.item.ItemStack stack)
      Description copied from interface: ItemFilter
      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.
      Specified by:
      matches in interface ItemFilter