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 Details

    • id

      private final String id
      The field for the id record component.
    • constructor

      private final Function<SavedData.Context,T extends SavedData> constructor
      The field for the constructor record component.
    • codec

      private final Function<SavedData.Context,com.mojang.serialization.Codec<T extends SavedData>> codec
      The field for the codec record component.
    • dataFixType

      @Nullable private final @Nullable DataFixTypes dataFixType
      The field for the dataFixType record component.
  • Constructor Details

    • SavedDataType

      public SavedDataType(String id, Function<SavedData.Context,T> constructor, Function<SavedData.Context,com.mojang.serialization.Codec<T>> codec)
    • SavedDataType

      public SavedDataType(String id, Supplier<T> constructor, com.mojang.serialization.Codec<T> codec)
    • 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 a SavedDataType record class.
      Parameters:
      id - the value for the id record component
      constructor - the value for the constructor record component
      codec - the value for the codec record component
      dataFixType - the value for the dataFixType record component
  • Method Details

    • equals

      public boolean equals(Object other)
      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 Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      other - the object with which to compare
      Returns:
      true if this object is the same as the other argument; false otherwise.
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • toString

      public String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • constructor

      public Function<SavedData.Context,T> constructor()
      Returns the value of the constructor record component.
      Returns:
      the value of the constructor record component
    • codec

      public Function<SavedData.Context,com.mojang.serialization.Codec<T>> codec()
      Returns the value of the codec record component.
      Returns:
      the value of the codec record component
    • dataFixType

      @Nullable public @Nullable DataFixTypes dataFixType()
      Returns the value of the dataFixType record component.
      Returns:
      the value of the dataFixType record component