Record Class SavedDataType<T extends SavedData>
java.lang.Object
java.lang.Record
net.minecraft.world.level.saveddata.SavedDataType<T>
public record SavedDataType<T extends SavedData>(String id, Function<SavedData.Context,T extends SavedData> constructor, Function<SavedData.Context,com.mojang.serialization.Codec<T extends SavedData>> codec, @Nullable DataFixTypes dataFixType)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Function<SavedData.Context, com.mojang.serialization.Codec<T>> The field for thecodecrecord component.private final Function<SavedData.Context, T> The field for theconstructorrecord component.private final @Nullable DataFixTypesThe field for thedataFixTyperecord component.private final StringThe field for theidrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionSavedDataType(String id, Function<SavedData.Context, T> constructor, Function<SavedData.Context, com.mojang.serialization.Codec<T>> codec) SavedDataType(String id, Function<SavedData.Context, T> constructor, Function<SavedData.Context, com.mojang.serialization.Codec<T>> codec, @Nullable DataFixTypes dataFixType) Creates an instance of aSavedDataTyperecord class.SavedDataType(String id, Supplier<T> constructor, com.mojang.serialization.Codec<T> codec) SavedDataType(String p_401076_, Supplier<T> p_401163_, com.mojang.serialization.Codec<T> p_401275_, @Nullable DataFixTypes p_401088_) -
Method Summary
Modifier and TypeMethodDescriptionFunction<SavedData.Context, com.mojang.serialization.Codec<T>> codec()Returns the value of thecodecrecord component.Returns the value of theconstructorrecord component.@Nullable DataFixTypesReturns the value of thedataFixTyperecord component.booleanIndicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.toString()Returns a string representation of this record class.
-
Field Details
-
id
The field for theidrecord component. -
constructor
The field for theconstructorrecord component. -
codec
The field for thecodecrecord component. -
dataFixType
The field for thedataFixTyperecord component.
-
-
Constructor Details
-
SavedDataType
public SavedDataType(String id, Function<SavedData.Context, T> constructor, Function<SavedData.Context, com.mojang.serialization.Codec<T>> codec) -
SavedDataType
-
SavedDataType
public SavedDataType(String p_401076_, Supplier<T> p_401163_, com.mojang.serialization.Codec<T> p_401275_, @Nullable @Nullable DataFixTypes p_401088_) -
SavedDataType
public SavedDataType(String id, Function<SavedData.Context, T> constructor, Function<SavedData.Context, com.mojang.serialization.Codec<T>> codec, @Nullable @Nullable DataFixTypes dataFixType) Creates an instance of aSavedDataTyperecord class.- Parameters:
id- the value for theidrecord componentconstructor- the value for theconstructorrecord componentcodec- the value for thecodecrecord componentdataFixType- the value for thedataFixTyperecord component
-
-
Method Details
-
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). -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
constructor
Returns the value of theconstructorrecord component.- Returns:
- the value of the
constructorrecord component
-
codec
Returns the value of thecodecrecord component.- Returns:
- the value of the
codecrecord component
-
dataFixType
Returns the value of thedataFixTyperecord component.- Returns:
- the value of the
dataFixTyperecord component
-