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 thepredicate
record component. -
Constructor Summary
ConstructorsConstructorDescriptionComponentMatches
(DataComponentPredicate.Single<?> predicate) Creates an instance of aComponentMatches
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.boolean
get
(ItemStack p_399920_, ClientLevel p_399844_, LivingEntity p_399573_, int p_400095_, ItemDisplayContext p_400208_) final int
hashCode()
Returns a hash code value for this object.Returns the value of thepredicate
record component.final String
toString()
Returns a string representation of this record class.com.mojang.serialization.MapCodec
<ComponentMatches> type()
-
Field Details
-
predicate
The field for thepredicate
record component. -
MAP_CODEC
-
-
Constructor Details
-
ComponentMatches
Creates an instance of aComponentMatches
record class.- Parameters:
predicate
- the value for thepredicate
record component
-
-
Method Details
-
get
public boolean get(ItemStack p_399920_, @Nullable ClientLevel p_399844_, @Nullable LivingEntity p_399573_, int p_400095_, ItemDisplayContext p_400208_) - Specified by:
get
in interfaceItemModelPropertyTest
-
type
- Specified by:
type
in interfaceConditionalItemModelProperty
-
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)
. -
predicate
Returns the value of thepredicate
record component.- Returns:
- the value of the
predicate
record component
-