aboutsummaryrefslogtreecommitdiff
path: root/test-common/src/main/java/dev/isxander/yacl3/test
diff options
context:
space:
mode:
authorisXander <xandersmith2008@gmail.com>2023-08-15 00:16:13 +0100
committerisXander <xandersmith2008@gmail.com>2023-08-15 00:16:13 +0100
commit5523d357f35410a043e83ef4a9506c806056f392 (patch)
treee2f88e5303394165d806ceb500cbd123276df349 /test-common/src/main/java/dev/isxander/yacl3/test
parentb3355266572deef1a5c3e494ad162c592383e455 (diff)
downloadYetAnotherConfigLib-5523d357f35410a043e83ef4a9506c806056f392.tar.gz
YetAnotherConfigLib-5523d357f35410a043e83ef4a9506c806056f392.tar.bz2
YetAnotherConfigLib-5523d357f35410a043e83ef4a9506c806056f392.zip
Added json5 to gson serializer
Diffstat (limited to 'test-common/src/main/java/dev/isxander/yacl3/test')
-rw-r--r--test-common/src/main/java/dev/isxander/yacl3/test/ConfigV2Test.java9
-rw-r--r--test-common/src/main/java/dev/isxander/yacl3/test/GuiTest.java5
2 files changed, 10 insertions, 4 deletions
diff --git a/test-common/src/main/java/dev/isxander/yacl3/test/ConfigV2Test.java b/test-common/src/main/java/dev/isxander/yacl3/test/ConfigV2Test.java
index 6084e23..d287604 100644
--- a/test-common/src/main/java/dev/isxander/yacl3/test/ConfigV2Test.java
+++ b/test-common/src/main/java/dev/isxander/yacl3/test/ConfigV2Test.java
@@ -12,18 +12,21 @@ public class ConfigV2Test {
public static ConfigClassHandler<ConfigV2Test> INSTANCE = ConfigClassHandler.createBuilder(ConfigV2Test.class)
.id(new ResourceLocation("yacl3", "config"))
.serializer(config -> GsonConfigSerializerBuilder.create(config)
- .setPath(YACLPlatform.getConfigDir().resolve("yacl-test-v2.json"))
+ .setPath(YACLPlatform.getConfigDir().resolve("yacl-test-v2.json5"))
+ .setJson5(true)
.build())
.autoGen(true)
.build();
@AutoGen(category = "test", group = "master_test")
@MasterTickBox({ "testTickBox", "testInt" })
- @SerialEntry public boolean masterOption = true;
+ @SerialEntry(comment = "This option does this and that which is cool because this...")
+ public boolean masterOption = true;
@AutoGen(category = "test", group = "master_test")
@TickBox
- @SerialEntry public boolean testTickBox = true;
+ @SerialEntry(comment = "This is a cool comment omg this is amazing")
+ public boolean testTickBox = true;
@AutoGen(category = "test", group = "master_test")
@IntSlider(min = 0, max = 10, step = 2)
diff --git a/test-common/src/main/java/dev/isxander/yacl3/test/GuiTest.java b/test-common/src/main/java/dev/isxander/yacl3/test/GuiTest.java
index 2eadb2a..4953d0c 100644
--- a/test-common/src/main/java/dev/isxander/yacl3/test/GuiTest.java
+++ b/test-common/src/main/java/dev/isxander/yacl3/test/GuiTest.java
@@ -44,7 +44,10 @@ public class GuiTest {
.build())
.option(ButtonOption.createBuilder()
.name(Component.literal("Auto-gen test"))
- .action((screen, opt) -> Minecraft.getInstance().setScreen(ConfigV2Test.INSTANCE.generateGui().generateScreen(screen)))
+ .action((screen, opt) -> {
+ ConfigV2Test.INSTANCE.serializer().deserialize();
+ Minecraft.getInstance().setScreen(ConfigV2Test.INSTANCE.generateGui().generateScreen(screen));
+ })
.build())
.group(OptionGroup.createBuilder()
.name(Component.literal("Wiki"))