Package net.minecraft.network.syncher
Record Class SynchedEntityData.DataValue<T>
java.lang.Object
java.lang.Record
net.minecraft.network.syncher.SynchedEntityData.DataValue<T>
- Enclosing class:
- SynchedEntityData
public static record SynchedEntityData.DataValue<T>(int id, EntityDataSerializer<T> serializer, T value)
extends Record
-
Field Summary
Modifier and TypeFieldDescriptionprivate final int
The field for theid
record component.private final EntityDataSerializer<T>
The field for theserializer
record component.private final T
The field for thevalue
record component. -
Constructor Summary
ConstructorDescriptionDataValue
(int id, EntityDataSerializer<T> serializer, T value) Creates an instance of aDataValue
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> SynchedEntityData.DataValue<T>
create
(EntityDataAccessor<T> p_254543_, T p_254138_) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
id()
Returns the value of theid
record component.static SynchedEntityData.DataValue<?>
read
(FriendlyByteBuf p_254314_, int p_254356_) private static <T> SynchedEntityData.DataValue<T>
read
(FriendlyByteBuf p_254224_, int p_253899_, EntityDataSerializer<T> p_254222_) Returns the value of theserializer
record component.final String
toString()
Returns a string representation of this record class.value()
Returns the value of thevalue
record component.void
write
(FriendlyByteBuf p_253709_)
-
Field Details
-
id
private final int idThe field for theid
record component. -
serializer
The field for theserializer
record component. -
value
The field for thevalue
record component.
-
-
Constructor Details
-
DataValue
Creates an instance of aDataValue
record class.- Parameters:
id
- the value for theid
record componentserializer
- the value for theserializer
record componentvalue
- the value for thevalue
record component
-
-
Method Details
-
create
public static <T> SynchedEntityData.DataValue<T> create(EntityDataAccessor<T> p_254543_, T p_254138_) -
write
-
read
-
read
private static <T> SynchedEntityData.DataValue<T> read(FriendlyByteBuf p_254224_, int p_253899_, EntityDataSerializer<T> p_254222_) -
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
id
public int id()Returns the value of theid
record component.- Returns:
- the value of the
id
record component
-
serializer
Returns the value of theserializer
record component.- Returns:
- the value of the
serializer
record component
-
value
Returns the value of thevalue
record component.- Returns:
- the value of the
value
record component
-