diff options
| author | inyourwalls <inyourwalls@tutanota.com> | 2024-02-19 17:46:42 -0500 |
|---|---|---|
| committer | inyourwalls <inyourwalls@tutanota.com> | 2024-02-19 17:46:42 -0500 |
| commit | 327be47178bebb323f618c6a6d36a12d3b15dbe4 (patch) | |
| tree | 3332675ceb9d438428bdc2b89a3f05e95c057cf2 /src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColour.java | |
| parent | fc6f881f9ca78c9f81e5a40291f9bd292789219a (diff) | |
create config class, start working on config screen
Diffstat (limited to 'src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColour.java')
| -rw-r--r-- | src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColour.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColour.java b/src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColour.java new file mode 100644 index 0000000..f80e0f4 --- /dev/null +++ b/src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColour.java @@ -0,0 +1,30 @@ +package net.inyourwalls.customlevelcolour; + +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.loader.api.FabricLoader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.nio.file.Path; + +public class CustomLevelColour implements ClientModInitializer { + public static final Logger LOGGER = LoggerFactory.getLogger(CustomLevelColour.class); + private static final Path CONFIG_PATH = FabricLoader.getInstance().getConfigDir().resolve("customlevelcolour.json"); + private static CustomLevelColourConfig config; + + @Override + public void onInitializeClient() { + try { + config = CustomLevelColourConfig.load(CONFIG_PATH); + } catch (IOException ex) { + LOGGER.debug("Failed to load config", ex); + config = new CustomLevelColourConfig(); + } + } + + public static CustomLevelColourConfig getConfig() { + if (config == null) throw new IllegalStateException("Attempted to get the configuration before it was loaded"); + return config; + } +} |
