Quilt config 1.3.0 Changelog
Quilt Config 1.3.0 brings a veritable treasure trove of new annotations, bringing a whopping 5 new metadata options! It also brings improvements to processors, fixes for the old WrappedConfig
API, and some brand-new API to top it all off. With the new features added in this update, it should finally be viable to build the automatic config screen generator we’ve been dreaming of!
- add
@SerializedNameConvention
annotation- can be applied to classes, fields, and sections
- similar to
@SerializedName
, allows you to define a different name to be used for your config - contrary to
@SerializedName
, you do not manually define the names: instead, the annotation will automatically convert your fields’ names to match your chosen convention. for example, if you choosesnake_case
, as is the recommendation for TOML,veryCuteField
becomesvery_cute_field
when serialized.@SerializedName
will always take priority over converted names! - the ideal way to use this is to apply it to your entire class via just one annotation!
- add
@Alias
annotation- can be applied to fields and sections
- defines a previous name for the field or section, allowing you to migrate old configs. for example, if you now want a config section to be named
GeorgeSection
after you removeJoe
and addGeorge
, you can use@Alias("JoeSection")
to automatically migrate oldJoe
configs to the newGeorge
name
- add
@DisplayName
annotation- can be applied to configs, sections, and fields
- does not have any functionality in the base quilt config API. instead, this metadata is intended to be used by metadata processors, other programs making use of quilt config’s information. an example metadata processor, and one we’re planning to build, is an automatic config screen generator that works on all mods using quilt config!
- defines the user-facing name of the config field, for metadata processors implementing visual config editors. allows translatability!
- add
@DisplayNameConvention
annotation- can be applied to configs, sections, and fields
- similar to
@DisplayName
, has no functionality in base quilt config. - defines a convention for transforming field names into display names, pulling from the same convention options as
@SerializedNameConvention
. for example, useSpace Separated Uppercase
to turnsuperAdorableField
intoSuper Adorable Field
.@DisplayName
will always take priority over transformed names!
- add
@ChangeWarning
annotation- can be applied to configs, sections, and fields
- has no functionality in base quilt config
- used to tell visual config editors that they should show a warning before applying changes to config fields. contains lots of options for warnings:
RequiresRestart
,Unsafe
,Experimental
,CustomTranslatable
, orCustom
.
- add an overload for
setValue
with theserialize
parameter defaulted totrue
to allow for more concise code - allow using the
@Processor
annotation on sections - add extensive javadoc for
@Processor
(on top of the tutorial on the developer wiki!) - allow using non-final values as config fields in
WrappedConfig
- the previous system would simply not work for a few types, notably
String
: due to the field being final, the JVM would inline some references to it, making them unmodifiable for us - now, a warning will be shown for anyone using
final
modifiers in theirWrappedConfig
classes. we recommend moving toReflectiveConfig
, but you can also simply remove the modifier!
- the previous system would simply not work for a few types, notably
- add a new API for inheriting metadata in the
ConfigBuilder
: this allows adding metadata via processors to work the same way as adding it via annotations- when the new
inherited
parameter ofMetadataType
is set to true, that metadata will be propagated to all children of the section or class you apply the metadata to
- when the new
- fix useless default comments being added for custom serializable values that do not override
toString
# default: MySerializableClass@fe34g6
is not exactly helpful to the user
- fix documentation mentioning primitive types (
int
,double
, etc) when theReflectiveConfig
API calls for the usage of classes (Integer
,Double
) - add checkstyle to clean up code a bit