Package alexiil.mc.lib.attributes
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>
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ItemAttributeList(Attribute<T> attribute)
ItemAttributeList(Attribute<T> attribute, java.util.function.Predicate<T> searchMatcher)
-
Method Summary
Modifier and Type Method Description void
add(T object)
Directly adds the given object to this list.T
combine(AttributeList<T> after, CombinableAttribute<T> combinable)
int
getOfferedCount()
boolean
hasOfferedAny()
void
offer(java.lang.Object object)
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
public void offer(java.lang.Object object)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.
-