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
ConstructorDescriptionItemAttributeList(Attribute<T> attribute)
ItemAttributeList(Attribute<T> attribute, Predicate<T> searchMatcher)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Directly adds the given object to this list.combine(AttributeList<T> after, CombinableAttribute<T> combinable)
int
boolean
void
Offers 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 alladded
objects.
-
-
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 beconverted
into it) then this will not affect this list.- Parameters:
object
- The object to offer, which may implementConvertible
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 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.
-