From 0a10f11494db07f974b416c1f69184728b68374c Mon Sep 17 00:00:00 2001 From: isXander Date: Wed, 28 Feb 2024 22:31:04 +0000 Subject: Add config for future use --- .../java/dev/isxander/yacl3/platform/YACLConfig.java | 16 ++++++++++++++++ .../java/dev/isxander/yacl3/platform/YACLEntrypoint.java | 11 +++++++++++ .../java/dev/isxander/yacl3/platform/YACLPlatform.java | 5 +++++ 3 files changed, 32 insertions(+) create mode 100644 common/src/main/java/dev/isxander/yacl3/platform/YACLConfig.java create mode 100644 common/src/main/java/dev/isxander/yacl3/platform/YACLEntrypoint.java (limited to 'common/src/main/java/dev/isxander') 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 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); + } } -- cgit