diff options
author | isXander <xander@isxander.dev> | 2024-02-28 22:31:04 +0000 |
---|---|---|
committer | isXander <xander@isxander.dev> | 2024-02-28 22:31:04 +0000 |
commit | 0a10f11494db07f974b416c1f69184728b68374c (patch) | |
tree | cfdd3ae491aeb93cd5c70135b42603df4e9b651f /common/src/main/java/dev/isxander | |
parent | cb8a5499a60e319a01ccde735f78717eeeb9b92c (diff) | |
download | YetAnotherConfigLib-0a10f11494db07f974b416c1f69184728b68374c.tar.gz YetAnotherConfigLib-0a10f11494db07f974b416c1f69184728b68374c.tar.bz2 YetAnotherConfigLib-0a10f11494db07f974b416c1f69184728b68374c.zip |
Add config for future use
Diffstat (limited to 'common/src/main/java/dev/isxander')
3 files changed, 32 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); + } } |