Record Class ConfigReference
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.config.ConfigReference
- Record Components:
target- The primaryConfigDescriptiontarget to evaluate first.fallback- An optional secondaryConfigDescriptionused when the primary target's mod is not loaded.
public record ConfigReference(johnsmith.configoverhauled.api.data.ConfigDescription target, Optional<johnsmith.configoverhauled.api.data.ConfigDescription> fallback)
extends Record
Represents a reference to a dynamic configuration property, supporting both direct targeting and
conditional mod-dependent fallback resolution (
"try_config" / "else_config").
During resolution, if a fallback is defined and the primary target mod is not loaded
according to ModLoadEvaluator, the reference transparently falls back to the secondary target.
If the resulting target's ConfigManager is absent, the reference is routed through
OrphanHandler for adoption.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ConfigReference> Primary codec capable of serializing and deserializing either a directConfigDescriptionobject or a conditional"try_config"/"else_config"structure. -
Constructor Summary
ConstructorsConstructorDescriptionConfigReference(johnsmith.configoverhauled.api.data.ConfigDescription target, Optional<johnsmith.configoverhauled.api.data.ConfigDescription> fallback) Creates an instance of aConfigReferencerecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Optional<johnsmith.configoverhauled.api.data.ConfigDescription> fallback()Returns the value of thefallbackrecord component.final inthashCode()Returns a hash code value for this object.johnsmith.configoverhauled.api.data.ConfigDescriptionresolve()Resolves the activeConfigDescriptionfor the current runtime environment.johnsmith.configoverhauled.api.data.ConfigDescriptiontarget()Returns the value of thetargetrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
Primary codec capable of serializing and deserializing either a directConfigDescriptionobject or a conditional"try_config"/"else_config"structure.
-
-
Constructor Details
-
ConfigReference
public ConfigReference(johnsmith.configoverhauled.api.data.ConfigDescription target, Optional<johnsmith.configoverhauled.api.data.ConfigDescription> fallback) Creates an instance of aConfigReferencerecord class.
-
-
Method Details
-
resolve
public johnsmith.configoverhauled.api.data.ConfigDescription resolve()Resolves the activeConfigDescriptionfor the current runtime environment.Evaluates
fallbackif present and the primary target's mod is not loaded. If noConfigManageris registered for the active target's namespace, the description is passed toOrphanHandler.adopt(ConfigDescription).- Returns:
- The resolved, valid
ConfigDescription.
-
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). -
target
-
fallback
-