aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/src/main/java/dev/isxander/yacl3/platform/YACLConfig.java16
-rw-r--r--common/src/main/java/dev/isxander/yacl3/platform/YACLEntrypoint.java11
-rw-r--r--common/src/main/java/dev/isxander/yacl3/platform/YACLPlatform.java5
-rw-r--r--fabric/src/main/java/dev/isxander/yacl3/platform/fabric/YACLFabricEntrypoint.java2
-rw-r--r--neoforge/src/main/java/dev/isxander/yacl3/platform/neoforge/YACLForgeEntrypoint.java2
5 files changed, 36 insertions, 0 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/platform/YACLConfig.java b/common/src/main/java/dev/isxander/yacl3/platform/YACLConfig.java
new file mode 100644
index 0000000..2bc27ef
--- /dev/null
+++ b/common/src/main/java/dev/isxander/yacl3/platform/YACLConfig.java
@@ -0,0 +1,16 @@
+package dev.isxander.yacl3.platform;
+
+import dev.isxander.yacl3.config.v2.api.ConfigClassHandler;
+import dev.isxander.yacl3.config.v2.api.serializer.GsonConfigSerializerBuilder;
+
+public class YACLConfig {
+ public static final ConfigClassHandler<YACLConfig> HANDLER = ConfigClassHandler.createBuilder(YACLConfig.class)
+ .id(YACLPlatform.rl("config"))
+ .serializer(config -> GsonConfigSerializerBuilder.create(config)
+ .setPath(YACLPlatform.getConfigDir().resolve("yacl.json5"))
+ .setJson5(true)
+ .build())
+ .build();
+
+ // place future configuration here
+}
diff --git a/common/src/main/java/dev/isxander/yacl3/platform/YACLEntrypoint.java b/common/src/main/java/dev/isxander/yacl3/platform/YACLEntrypoint.java
new file mode 100644
index 0000000..32cfc81
--- /dev/null
+++ b/common/src/main/java/dev/isxander/yacl3/platform/YACLEntrypoint.java
@@ -0,0 +1,11 @@
+package dev.isxander.yacl3.platform;
+
+import dev.isxander.yacl3.impl.utils.YACLConstants;
+
+public class YACLEntrypoint {
+ public static void onInitializeClient() {
+ YACLConfig.HANDLER.load();
+
+ YACLConstants.LOGGER.info("YetAnotherConfigLib initialised.");
+ }
+}
diff --git a/common/src/main/java/dev/isxander/yacl3/platform/YACLPlatform.java b/common/src/main/java/dev/isxander/yacl3/platform/YACLPlatform.java
index 590723e..51e47bf 100644
--- a/common/src/main/java/dev/isxander/yacl3/platform/YACLPlatform.java
+++ b/common/src/main/java/dev/isxander/yacl3/platform/YACLPlatform.java
@@ -1,6 +1,7 @@
package dev.isxander.yacl3.platform;
import dev.architectury.injectables.annotations.ExpectPlatform;
+import net.minecraft.resources.ResourceLocation;
import java.nio.file.Path;
@@ -19,4 +20,8 @@ public final class YACLPlatform {
public static boolean isDevelopmentEnv() {
throw new AssertionError();
}
+
+ public static ResourceLocation rl(String path) {
+ return new ResourceLocation("yet_another_config_lib_v3", path);
+ }
}
diff --git a/fabric/src/main/java/dev/isxander/yacl3/platform/fabric/YACLFabricEntrypoint.java b/fabric/src/main/java/dev/isxander/yacl3/platform/fabric/YACLFabricEntrypoint.java
index 032f46b..411ba27 100644
--- a/fabric/src/main/java/dev/isxander/yacl3/platform/fabric/YACLFabricEntrypoint.java
+++ b/fabric/src/main/java/dev/isxander/yacl3/platform/fabric/YACLFabricEntrypoint.java
@@ -1,5 +1,6 @@
package dev.isxander.yacl3.platform.fabric;
+import dev.isxander.yacl3.platform.YACLEntrypoint;
import dev.isxander.yacl3.platform.fabric.image.YACLImageReloadListenerFabric;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
@@ -9,5 +10,6 @@ public class YACLFabricEntrypoint implements ClientModInitializer {
@Override
public void onInitializeClient() {
ResourceManagerHelper.get(PackType.CLIENT_RESOURCES).registerReloadListener(new YACLImageReloadListenerFabric());
+ YACLEntrypoint.onInitializeClient();
}
}
diff --git a/neoforge/src/main/java/dev/isxander/yacl3/platform/neoforge/YACLForgeEntrypoint.java b/neoforge/src/main/java/dev/isxander/yacl3/platform/neoforge/YACLForgeEntrypoint.java
index 488cbb1..84d62f5 100644
--- a/neoforge/src/main/java/dev/isxander/yacl3/platform/neoforge/YACLForgeEntrypoint.java
+++ b/neoforge/src/main/java/dev/isxander/yacl3/platform/neoforge/YACLForgeEntrypoint.java
@@ -1,6 +1,7 @@
package dev.isxander.yacl3.platform.neoforge;
import dev.isxander.yacl3.gui.image.YACLImageReloadListener;
+import dev.isxander.yacl3.platform.YACLEntrypoint;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext;
@@ -13,6 +14,7 @@ public class YACLForgeEntrypoint {
modEventBus.addListener(RegisterClientReloadListenersEvent.class, event -> {
event.registerReloadListener(new YACLImageReloadListener());
});
+ YACLEntrypoint.onInitializeClient();
}
}