Record Class AttributeModifiersPredicate
java.lang.Object
java.lang.Record
net.minecraft.core.component.predicates.AttributeModifiersPredicate
- All Implemented Interfaces:
SingleComponentItemPredicate<ItemAttributeModifiers>
,DataComponentPredicate
public record AttributeModifiersPredicate(Optional<CollectionPredicate<ItemAttributeModifiers.Entry,AttributeModifiersPredicate.EntryPredicate>> modifiers)
extends Record
implements SingleComponentItemPredicate<ItemAttributeModifiers>
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface net.minecraft.core.component.predicates.DataComponentPredicate
DataComponentPredicate.Single<T extends DataComponentPredicate>, DataComponentPredicate.Type<T extends DataComponentPredicate>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec
<AttributeModifiersPredicate> private final Optional
<CollectionPredicate<ItemAttributeModifiers.Entry, AttributeModifiersPredicate.EntryPredicate>> The field for themodifiers
record component.Fields inherited from interface net.minecraft.core.component.predicates.DataComponentPredicate
SINGLE_STREAM_CODEC, STREAM_CODEC
-
Constructor Summary
ConstructorsConstructorDescriptionAttributeModifiersPredicate
(Optional<CollectionPredicate<ItemAttributeModifiers.Entry, AttributeModifiersPredicate.EntryPredicate>> modifiers) Creates an instance of aAttributeModifiersPredicate
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
matches
(DataComponentGetter getter) boolean
matches
(ItemAttributeModifiers p_399563_) Optional
<CollectionPredicate<ItemAttributeModifiers.Entry, AttributeModifiersPredicate.EntryPredicate>> Returns the value of themodifiers
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
modifiers
private final Optional<CollectionPredicate<ItemAttributeModifiers.Entry,AttributeModifiersPredicate.EntryPredicate>> modifiersThe field for themodifiers
record component. -
CODEC
-
-
Constructor Details
-
AttributeModifiersPredicate
public AttributeModifiersPredicate(Optional<CollectionPredicate<ItemAttributeModifiers.Entry, AttributeModifiersPredicate.EntryPredicate>> modifiers) Creates an instance of aAttributeModifiersPredicate
record class.- Parameters:
modifiers
- the value for themodifiers
record component
-
-
Method Details
-
componentType
- Specified by:
componentType
in interfaceSingleComponentItemPredicate<ItemAttributeModifiers>
-
matches
- Specified by:
matches
in interfaceSingleComponentItemPredicate<ItemAttributeModifiers>
-
matches
- Specified by:
matches
in interfaceDataComponentPredicate
- Specified by:
matches
in interfaceSingleComponentItemPredicate<ItemAttributeModifiers>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
modifiers
public Optional<CollectionPredicate<ItemAttributeModifiers.Entry,AttributeModifiersPredicate.EntryPredicate>> modifiers()Returns the value of themodifiers
record component.- Returns:
- the value of the
modifiers
record component
-