aboutsummaryrefslogtreecommitdiff
path: root/changelogs
diff options
context:
space:
mode:
authorisXander <xandersmith2008@gmail.com>2023-09-24 16:23:35 +0100
committerisXander <xandersmith2008@gmail.com>2023-09-24 16:23:35 +0100
commite44be35f9e35784154934c5aba8c44535d5956a7 (patch)
treec3ad43e32b29c52b3a6d0ee53d002250180f0595 /changelogs
parentd2b67633c1d3ca0c46682b05955dafafd3597f1d (diff)
downloadYetAnotherConfigLib-e44be35f9e35784154934c5aba8c44535d5956a7.tar.gz
YetAnotherConfigLib-e44be35f9e35784154934c5aba8c44535d5956a7.tar.bz2
YetAnotherConfigLib-e44be35f9e35784154934c5aba8c44535d5956a7.zip
changelog + update version on publishing and mod metadata
Diffstat (limited to 'changelogs')
-rw-r--r--changelogs/3.2.0+1.20.2.md89
1 files changed, 89 insertions, 0 deletions
diff --git a/changelogs/3.2.0+1.20.2.md b/changelogs/3.2.0+1.20.2.md
new file mode 100644
index 0000000..f52d5c4
--- /dev/null
+++ b/changelogs/3.2.0+1.20.2.md
@@ -0,0 +1,89 @@
+# YetAnotherConfigLib 3.2 for 1.20.2
+
+The artifact for this release is
+`dev.isxander.yacl:yet-another-config-lib-fabric:3.2.0+1.20.2` (assuming Fabric)
+
+## Config API V2
+
+Starting this update, the previous config api is now deprecated.
+
+The new API is much more modular, and is now fully API-safe.
+
+### What does it look like?
+```java
+public class MyConfig {
+ public static final ConfigClassHandler<MyConfig> HANDLER = ConfigClassHandler.createBuilder(MyConfig.class)
+ .id(new ResourceLocation("my_mod", "my_config")) // unique ID for your config
+ .serializer(config -> GsonConfigSerializerBuilder.create(config)
+ .setPath(FabricLoader.getInstance().getConfigDir().resolve("my_config.json"))
+ .setJson5(true) // json5 support, with GSON!
+ .build())
+ .build();
+
+ @SerialEntry(comment = "optional comment!")
+ public boolean myOption = true;
+
+ public static void save() {
+ MyConfig.HANDLER.serializer().save();
+ }
+
+ public static void load() {
+ MyConfig.HANDLER.serializer().load();
+ }
+}
+```
+
+As you can see from the above example, it's syntactically quite similar
+to the old API, but with a few key differences:
+- The method of serialization has been separated from the class handler itself,
+ allowing an API safe implementation without needing to override the class handler.
+- Supports abstract serialization.
+- Names make a lot more sense.
+
+### Auto-gen
+
+The new API can now fully auto-generate your config into a YACL GUI with annotations.
+I have been very wary of this feature, since usually it can be very limiting, destroying most
+of the core values of the powerful YACL builder interface. However, I believe I've found a great
+modular way so that developers can extend the auto-gen feature with their own custom annotations,
+adding support for their own custom controllers!
+
+```java
+public class MyConfig {
+ public static final ConfigClassHandler<MyConfig> HANDLER = ConfigClassHandler.createBuilder(MyConfig.class)
+ .id(new ResourceLocation("my_mod", "my_config")) // unique ID for your config
+ .serializer(config -> GsonConfigSerializerBuilder.create(config)
+ .setPath(FabricLoader.getInstance().getConfigDir().resolve("my_config.json"))
+ .setJson5(true) // json5 support, with GSON!
+ .build())
+ .build();
+
+ @AutoGen(category = "my_category", group = "my_group")
+ @Boolean(formatter = Boolean.Formatter.YES_NO, colored = true)
+ public boolean myOption = true;
+
+ public static Screen createScreen(Screen parent) {
+ return MyConfig.HANDLER.generateGui().generateScreen(parent);
+ }
+}
+```
+
+Above is an example of auto-generating a `BooleanController`. Notice how
+the field does not require `@SerialEntry`. These are completely separate,
+and you can use both at the same time.
+
+For the full range of auto-gen annotations, check the source!
+
+Documentation for the new API is still a work in progress. For now, it's best
+to look at the following class: [`dev.isxander.yacl3.test.AutogenConfigTest`](https://github.com/isXander/YetAnotherConfigLib/blob/1.20.x/dev/test-common/src/main/java/dev/isxander/yacl3/test/AutogenConfigTest.java) (not available on the artifact).
+
+## Fix Sodium crash
+
+This is bringing the off-branch hotfix 3.1.1 to the main branch.
+
+## Dropdown controllers
+
+[Crendgrim](https://github.com/isXander/Crendgrim) has PRed a dropdown controller! Which is in this release!
+
+This adds two new controller builders, `DropdownStringControllerBuilder` and `ItemControllerBuilder`.
+The latter renders the item in the dropdown, and suggests only the items.