Record Class CustomModelDataProperty
java.lang.Object
java.lang.Record
net.minecraft.client.renderer.item.properties.conditional.CustomModelDataProperty
- All Implemented Interfaces:
ConditionalItemModelProperty
,ItemModelPropertyTest
public record CustomModelDataProperty(int index)
extends Record
implements ConditionalItemModelProperty
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
The field for theindex
record component.static final com.mojang.serialization.MapCodec
<CustomModelDataProperty> -
Constructor Summary
ConstructorsConstructorDescriptionCustomModelDataProperty
(int index) Creates an instance of aCustomModelDataProperty
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.boolean
get
(ItemStack pStack, ClientLevel pLevel, LivingEntity pEntity, int pSeed, ItemDisplayContext pDisplayContext) final int
hashCode()
Returns a hash code value for this object.int
index()
Returns the value of theindex
record component.final String
toString()
Returns a string representation of this record class.com.mojang.serialization.MapCodec
<CustomModelDataProperty> type()
-
Field Details
-
index
private final int indexThe field for theindex
record component. -
MAP_CODEC
-
-
Constructor Details
-
CustomModelDataProperty
public CustomModelDataProperty(int index) Creates an instance of aCustomModelDataProperty
record class.- Parameters:
index
- the value for theindex
record component
-
-
Method Details
-
get
public boolean get(ItemStack pStack, @Nullable ClientLevel pLevel, @Nullable LivingEntity pEntity, int pSeed, ItemDisplayContext pDisplayContext) - 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 with '=='. -
index
public int index()Returns the value of theindex
record component.- Returns:
- the value of the
index
record component
-