aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle.kts2
-rw-r--r--changelogs/3.2.0+1.20.2.md89
-rw-r--r--fabric/build.gradle.kts5
-rw-r--r--fabric/src/main/resources/fabric.mod.json2
-rw-r--r--forge/build.gradle.kts8
-rw-r--r--forge/src/main/resources/META-INF/mods.toml2
-rw-r--r--test-common/src/main/java/dev/isxander/yacl3/test/AutogenConfigTest.java2
7 files changed, 99 insertions, 11 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index 4b22f3c..d469063 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -13,7 +13,7 @@ architectury {
minecraft = libs.versions.minecraft.get()
}
-version = "3.2.0+1.20"
+version = "3.2.0+1.20.2"
val isBeta = "beta" in version.toString()
val changelogText = rootProject.file("changelogs/${project.version}.md").takeIf { it.exists() }?.readText() ?: "No changelog provided."
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.
diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts
index b73de3a..36c6976 100644
--- a/fabric/build.gradle.kts
+++ b/fabric/build.gradle.kts
@@ -133,7 +133,7 @@ if (modrinthId.isNotEmpty()) {
versionNumber.set("${project.version}-fabric")
versionType.set(if (isBeta) "beta" else "release")
uploadFile.set(tasks["remapJar"])
- gameVersions.set(listOf("1.20", "1.20.1"))
+ gameVersions.set(listOf("1.20.2"))
loaders.set(listOf("fabric", "quilt"))
changelog.set(changelogText)
syncBodyFrom.set(rootProject.file("README.md").readText())
@@ -152,8 +152,7 @@ if (hasProperty("curseforge.token") && curseforgeId.isNotEmpty()) {
id = curseforgeId
releaseType = if (isBeta) "beta" else "release"
- addGameVersion("1.20")
- addGameVersion("1.20.1")
+ addGameVersion("1.20.2")
addGameVersion("Fabric")
addGameVersion("Java 17")
diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json
index f74fcd5..39260df 100644
--- a/fabric/src/main/resources/fabric.mod.json
+++ b/fabric/src/main/resources/fabric.mod.json
@@ -17,7 +17,7 @@
"environment": "*",
"depends": {
"fabricloader": ">=0.14.0",
- "minecraft": ">1.20-",
+ "minecraft": "~1.20.2",
"java": ">=17",
"fabric-resource-loader-v0": "*"
},
diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts
index 73e2ccb..01b4280 100644
--- a/forge/build.gradle.kts
+++ b/forge/build.gradle.kts
@@ -146,8 +146,8 @@ if (modrinthId.isNotEmpty()) {
versionNumber.set("${project.version}-forge")
versionType.set(if (isBeta) "beta" else "release")
uploadFile.set(tasks["remapJar"])
- gameVersions.set(listOf("1.20", "1.20.1"))
- loaders.set(listOf("forge"))
+ gameVersions.set(listOf("1.20.2"))
+ loaders.set(listOf("forge", "neoforge"))
changelog.set(changelogText)
syncBodyFrom.set(rootProject.file("README.md").readText())
}
@@ -165,9 +165,9 @@ if (hasProperty("curseforge.token") && curseforgeId.isNotEmpty()) {
id = curseforgeId
releaseType = if (isBeta) "beta" else "release"
- addGameVersion("1.20")
- addGameVersion("1.20.1")
+ addGameVersion("1.20.2")
addGameVersion("Forge")
+ addGameVersion("NeoForge")
addGameVersion("Java 17")
changelog = changelogText
diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml
index e6a0a07..dbd8461 100644
--- a/forge/src/main/resources/META-INF/mods.toml
+++ b/forge/src/main/resources/META-INF/mods.toml
@@ -23,6 +23,6 @@ side = "BOTH"
[["dependencies.${id}"]]
modId = "minecraft"
mandatory = true
-versionRange = "[1.19.4,)"
+versionRange = "[1.20.2,)"
ordering = "NONE"
side = "BOTH"
diff --git a/test-common/src/main/java/dev/isxander/yacl3/test/AutogenConfigTest.java b/test-common/src/main/java/dev/isxander/yacl3/test/AutogenConfigTest.java
index a664d91..b3b49b6 100644
--- a/test-common/src/main/java/dev/isxander/yacl3/test/AutogenConfigTest.java
+++ b/test-common/src/main/java/dev/isxander/yacl3/test/AutogenConfigTest.java
@@ -23,7 +23,7 @@ import java.awt.*;
import java.util.List;
public class AutogenConfigTest {
- public static ConfigClassHandler<AutogenConfigTest> INSTANCE = ConfigClassHandler.createBuilder(AutogenConfigTest.class)
+ public static final ConfigClassHandler<AutogenConfigTest> INSTANCE = ConfigClassHandler.createBuilder(AutogenConfigTest.class)
.id(new ResourceLocation("yacl3", "config"))
.serializer(config -> GsonConfigSerializerBuilder.create(config)
.setPath(YACLPlatform.getConfigDir().resolve("yacl-test-v2.json5"))