Record Class ComponentContents<T>
java.lang.Object
java.lang.Record
net.minecraft.client.renderer.item.properties.select.ComponentContents<T>
- All Implemented Interfaces:
SelectItemModelProperty<T>
public record ComponentContents<T>(DataComponentType<T> componentType)
extends Record
implements SelectItemModelProperty<T>
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.client.renderer.item.properties.select.SelectItemModelProperty
SelectItemModelProperty.Type<P extends SelectItemModelProperty<T>,
T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DataComponentType
<T> The field for thecomponentType
record component.private static final SelectItemModelProperty.Type
<? extends ComponentContents<?>, ?> -
Constructor Summary
ConstructorsConstructorDescriptionComponentContents
(DataComponentType<T> componentType) Creates an instance of aComponentContents
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> SelectItemModelProperty.Type
<ComponentContents<T>, T> castType()
Returns the value of thecomponentType
record component.private static <T> SelectItemModelProperty.Type
<ComponentContents<T>, T> final boolean
Indicates whether some other object is "equal to" this one.get
(ItemStack p_397602_, ClientLevel p_397414_, LivingEntity p_397883_, int p_397032_, ItemDisplayContext p_397548_) final int
hashCode()
Returns a hash code value for this object.final String
toString()
Returns a string representation of this record class.type()
com.mojang.serialization.Codec
<T>
-
Field Details
-
componentType
The field for thecomponentType
record component. -
TYPE
-
-
Constructor Details
-
ComponentContents
Creates an instance of aComponentContents
record class.- Parameters:
componentType
- the value for thecomponentType
record component
-
-
Method Details
-
createType
-
castType
-
get
@Nullable public T get(ItemStack p_397602_, @Nullable ClientLevel p_397414_, @Nullable LivingEntity p_397883_, int p_397032_, ItemDisplayContext p_397548_) - Specified by:
get
in interfaceSelectItemModelProperty<T>
-
type
- Specified by:
type
in interfaceSelectItemModelProperty<T>
-
valueCodec
- Specified by:
valueCodec
in interfaceSelectItemModelProperty<T>
-
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)
. -
componentType
Returns the value of thecomponentType
record component.- Returns:
- the value of the
componentType
record component
-