Package alexiil.mc.lib.attributes
Class ItemAttributeList<T>
java.lang.Object
alexiil.mc.lib.attributes.AbstractAttributeList<T>
alexiil.mc.lib.attributes.ItemAttributeList<T>
-
Field Summary
Fields inherited from class alexiil.mc.lib.attributes.AbstractAttributeList
attribute, list -
Constructor Summary
ConstructorsConstructorDescriptionItemAttributeList(Attribute<T> attribute) ItemAttributeList(Attribute<T> attribute, Predicate<T> searchMatcher) -
Method Summary
Modifier and TypeMethodDescriptionvoidDirectly adds the given object to this list.combine(AttributeList<T> after, CombinableAttribute<T> combinable) intbooleanvoidOffers the given object to this list.Methods inherited from class alexiil.mc.lib.attributes.AbstractAttributeList
assertAdding, assertUsing, combine, get, getCount, getFirst, getFirstOrNull
-
Constructor Details
-
ItemAttributeList
-
ItemAttributeList
- Parameters:
searchMatcher- A filter for alladdedobjects.
-
-
Method Details
-
add
Directly adds the given object to this list.- Parameters:
object- The object to add.
-
offer
Offers the given object to this list. If the given object is not an instance of the currentAbstractAttributeList.attribute(and it cannot beconvertedinto it) then this will not affect this list.- Parameters:
object- The object to offer, which may implementConvertibleif 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 tooffer(Object)and it's variants).
-
getOfferedCount
public int getOfferedCount()- Returns:
- The number of calls to
add(Object)(including calls tooffer(Object)and it's variants).
-
combine
- Returns:
- A combined version of this list and then the second given list, or the attribute's default value if both lists are empty.
-