aboutsummaryrefslogtreecommitdiff
path: root/test-common
diff options
context:
space:
mode:
Diffstat (limited to 'test-common')
-rw-r--r--test-common/src/main/java/dev/isxander/yacl3/test/ConfigTest.java14
-rw-r--r--test-common/src/main/java/dev/isxander/yacl3/test/GuiTest.java3
2 files changed, 10 insertions, 7 deletions
diff --git a/test-common/src/main/java/dev/isxander/yacl3/test/ConfigTest.java b/test-common/src/main/java/dev/isxander/yacl3/test/ConfigTest.java
index 3b5c8a5..3a057f9 100644
--- a/test-common/src/main/java/dev/isxander/yacl3/test/ConfigTest.java
+++ b/test-common/src/main/java/dev/isxander/yacl3/test/ConfigTest.java
@@ -1,16 +1,18 @@
package dev.isxander.yacl3.test;
-import dev.isxander.yacl3.config.ConfigEntry;
-import dev.isxander.yacl3.config.ConfigInstance;
-import dev.isxander.yacl3.config.GsonConfigInstance;
+import dev.isxander.yacl3.config.v2.api.ConfigClassHandler;
+import dev.isxander.yacl3.config.v2.api.ConfigEntry;
+import dev.isxander.yacl3.config.v2.api.GsonConfigSerializerBuilder;
+import dev.isxander.yacl3.platform.YACLPlatform;
import java.awt.*;
import java.util.List;
-import java.nio.file.Path;
public class ConfigTest {
- public static final ConfigInstance<ConfigTest> GSON = GsonConfigInstance.createBuilder(ConfigTest.class)
- .setPath(Path.of("./config/yacl-test.json"))
+ public static final ConfigClassHandler<ConfigTest> GSON = ConfigClassHandler.createBuilder(ConfigTest.class)
+ .serializer(config -> GsonConfigSerializerBuilder.create(config)
+ .setPath(YACLPlatform.getConfigDir().resolve("yacl-test.json"))
+ .build())
.build();
@ConfigEntry public boolean booleanToggle = false;
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 c490799..71e5545 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
@@ -57,6 +57,7 @@ public class GuiTest {
private static Screen getFullTestSuite(Screen parent) {
AtomicReference<Option<Boolean>> booleanOption = new AtomicReference<>();
+ ConfigTest.GSON.serializer().deserialize();
return YetAnotherConfigLib.create(ConfigTest.GSON, (defaults, config, builder) -> builder
.title(Component.literal("Test GUI"))
.category(ConfigCategory.createBuilder()
@@ -372,7 +373,7 @@ public class GuiTest {
.build())
.save(() -> {
Minecraft.getInstance().options.save();
- ConfigTest.GSON.save();
+ ConfigTest.GSON.serializer().serialize();
})
)
.generateScreen(parent);