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 | |
parent | cb8a5499a60e319a01ccde735f78717eeeb9b92c (diff) | |
download | YetAnotherConfigLib-0a10f11494db07f974b416c1f69184728b68374c.tar.gz YetAnotherConfigLib-0a10f11494db07f974b416c1f69184728b68374c.tar.bz2 YetAnotherConfigLib-0a10f11494db07f974b416c1f69184728b68374c.zip |
Add config for future use
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(); } } |