Basic usage of Config API
Learn about what the Config API does.
Last updated
Learn about what the Config API does.
Last updated
Along with YACL's primary functionality, the GUI, this mod also provides a super easy way to manage your mod's config. It can be a tedious part of every mod you make, this is why the Config API was created!
All you need to do is create a class, add some fields and tell YACL how to save and load your config.
That is it! That's all the setup you need for your config.
In this example, you can see that we told the config handler to use GSON to serialize your fields, meaning not just primitive/basic types work, but any! You can even see me modifying the GSON builder. Only fields annotated with @SerialEntry
are considered.
In the above example, you can see we specified the serializer like so:
You can see we specified the GSON serializer, set its path, configured GSON, and specified to use JSON5 spec. Currently, GSON is the only serializer made available to you. You can create your own, more on that later.
To save and load use the respected methods: