Record Class DynamicPropertyTypeRegistry.TypeDefinition<T>
java.lang.Object
java.lang.Record
johnsmith.configoverhauled.api.registry.DynamicPropertyTypeRegistry.TypeDefinition<T>
- Type Parameters:
T- The underlying data type managed by this property definition.- Record Components:
id- The absolute namespaced identifier (e.g., "modid:type").codec- The codec used for serialization and deserialization of the property value.factory- The factory responsible for instantiating the property state.
- Enclosing class:
DynamicPropertyTypeRegistry
public static record DynamicPropertyTypeRegistry.TypeDefinition<T>(String id, com.mojang.serialization.Codec<T> codec, PropertyFactory<T> factory)
extends Record
Encapsulates the configuration requirements for a specific property type.
-
Constructor Summary
ConstructorsConstructorDescriptionTypeDefinition(String id, com.mojang.serialization.Codec<T> codec, PropertyFactory<T> factory) Creates an instance of aTypeDefinitionrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.Codec<T> codec()Returns the value of thecodecrecord component.Instantiates a new dynamic property based on this type definition.final booleanIndicates whether some other object is "equal to" this one.factory()Returns the value of thefactoryrecord component.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TypeDefinition
public TypeDefinition(String id, com.mojang.serialization.Codec<T> codec, PropertyFactory<T> factory) Creates an instance of aTypeDefinitionrecord class.
-
-
Method Details
-
create
Instantiates a new dynamic property based on this type definition.- Parameters:
name- The internal name of the property.group- The parent group containing this property.def- The default value. Expected to cast safely to<T>.min- The lower bound limit, if applicable.max- The upper bound limit, if applicable.- Returns:
- A constructed
Propertyinstance.
-
toString
-
hashCode
-
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). -
id
-
codec
-
factory
-