Record Class SavedData.Factory<T extends SavedData>
java.lang.Object
java.lang.Record
net.minecraft.world.level.saveddata.SavedData.Factory<T>
- Enclosing class:
SavedData
public static record SavedData.Factory<T extends SavedData>(Supplier<T extends SavedData> constructor, BiFunction<CompoundTag,HolderLookup.Provider,T extends SavedData> deserializer, @Nullable DataFixTypes type)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe field for theconstructorrecord component.private final BiFunction<CompoundTag, HolderLookup.Provider, T> The field for thedeserializerrecord component.private final @Nullable DataFixTypesThe field for thetyperecord component. -
Constructor Summary
ConstructorsConstructorDescriptionFactory(Supplier<T> constructor, BiFunction<CompoundTag, HolderLookup.Provider, T> deserializer) Factory(Supplier<T> constructor, BiFunction<CompoundTag, HolderLookup.Provider, T> deserializer, @Nullable DataFixTypes type) Creates an instance of aFactoryrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconstructorrecord component.Returns the value of thedeserializerrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.@Nullable DataFixTypestype()Returns the value of thetyperecord component.
-
Field Details
-
constructor
The field for theconstructorrecord component. -
deserializer
The field for thedeserializerrecord component. -
type
The field for thetyperecord component.
-
-
Constructor Details
-
Factory
public Factory(Supplier<T> constructor, BiFunction<CompoundTag, HolderLookup.Provider, T> deserializer) -
Factory
public Factory(Supplier<T> constructor, BiFunction<CompoundTag, HolderLookup.Provider, T> deserializer, @Nullable @Nullable DataFixTypes type) Creates an instance of aFactoryrecord class.- Parameters:
constructor- the value for theconstructorrecord componentdeserializer- the value for thedeserializerrecord componenttype- the value for thetyperecord component
-
-
Method Details
-
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). -
constructor
Returns the value of theconstructorrecord component.- Returns:
- the value of the
constructorrecord component
-
deserializer
Returns the value of thedeserializerrecord component.- Returns:
- the value of the
deserializerrecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-