diff options
Diffstat (limited to 'common/src/main')
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); + } } |