Class ItemAttributeList<T>

java.lang.Object
alexiil.mc.lib.attributes.AbstractAttributeList<T>
alexiil.mc.lib.attributes.ItemAttributeList<T>

public class ItemAttributeList<T> extends AbstractAttributeList<T>
Variant of AttributeList but for Item's rather than Block's.
  • Constructor Details

    • ItemAttributeList

      public ItemAttributeList(Attribute<T> attribute)
    • ItemAttributeList

      public ItemAttributeList(Attribute<T> attribute, Predicate<T> searchMatcher)
      Parameters:
      searchMatcher - A filter for all added objects.
  • Method Details

    • add

      public void add(T object)
      Directly adds the given object to this list.
      Parameters:
      object - The object to add.
    • offer

      public void offer(Object object)
      Offers the given object to this list. If the given object is not an instance of the current AbstractAttributeList.attribute (and it cannot be converted into it) then this will not affect this list.
      Parameters:
      object - The object to offer, which may implement Convertible if it can be converted into many different forms.
    • hasOfferedAny

      public boolean hasOfferedAny()
      Returns:
      True if any calls to add(Object) have been made. (Including calls to offer(Object) and it's variants).
    • getOfferedCount

      public int getOfferedCount()
      Returns:
      The number of calls to add(Object) (including calls to offer(Object) and it's variants).
    • combine

      @Nonnull public T combine(AttributeList<T> after, CombinableAttribute<T> combinable)
      Returns:
      A combined version of this list and then the second given list, or the attribute's default value if both lists are empty.