Record Class ComponentMatches
java.lang.Object
java.lang.Record
net.minecraft.client.renderer.item.properties.conditional.ComponentMatches
- All Implemented Interfaces:
ConditionalItemModelProperty, ItemModelPropertyTest
public record ComponentMatches(DataComponentPredicate.Single<?> predicate)
extends Record
implements ConditionalItemModelProperty
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ComponentMatches> private final DataComponentPredicate.Single<?> The field for thepredicaterecord component. -
Constructor Summary
ConstructorsConstructorDescriptionComponentMatches(DataComponentPredicate.Single<?> predicate) Creates an instance of aComponentMatchesrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.booleanget(ItemStack itemStack, @Nullable ClientLevel level, @Nullable LivingEntity owner, int seed, ItemDisplayContext displayContext) final inthashCode()Returns a hash code value for this object.Returns the value of thepredicaterecord component.final StringtoString()Returns a string representation of this record class.com.mojang.serialization.MapCodec<ComponentMatches> type()
-
Field Details
-
predicate
The field for thepredicaterecord component. -
MAP_CODEC
-
-
Constructor Details
-
ComponentMatches
Creates an instance of aComponentMatchesrecord class.- Parameters:
predicate- the value for thepredicaterecord component
-
-
Method Details
-
get
public boolean get(ItemStack itemStack, @Nullable ClientLevel level, @Nullable LivingEntity owner, int seed, ItemDisplayContext displayContext) - Specified by:
getin interfaceItemModelPropertyTest
-
type
- Specified by:
typein interfaceConditionalItemModelProperty
-
toString
-
hashCode
-
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). -
predicate
Returns the value of thepredicaterecord component.- Returns:
- the value of the
predicaterecord component
-