From fe8261cf7c10af90c0154633a6a8f18b3e5bfb12 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 1 May 2022 11:23:06 +0200 Subject: icons sidebar, categories in config, fix some other issues --- .../io/polyfrost/oneconfig/config/interfaces/Config.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java') diff --git a/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java b/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java index af3d037..211c2ce 100644 --- a/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java +++ b/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java @@ -8,7 +8,10 @@ import io.polyfrost.oneconfig.config.data.Mod; import io.polyfrost.oneconfig.config.data.OptionCategory; import io.polyfrost.oneconfig.config.data.OptionPage; import io.polyfrost.oneconfig.config.profiles.Profiles; +import io.polyfrost.oneconfig.gui.OneConfigGui; import io.polyfrost.oneconfig.gui.elements.config.*; +import io.polyfrost.oneconfig.gui.pages.ModConfigPage; +import net.minecraft.client.Minecraft; import java.io.*; import java.lang.reflect.Field; @@ -20,6 +23,7 @@ import java.util.*; public class Config { protected final String configFile; protected final Gson gson = new GsonBuilder().excludeFieldsWithModifiers(Modifier.TRANSIENT).setPrettyPrinting().registerTypeAdapterFactory(OneConfigTypeAdapterFactory.getStaticTypeAdapterFactory()).create(); + private static Mod mod; /** * @param modData information about the mod @@ -36,6 +40,7 @@ public class Config { mod.config = this; generateOptionList(this.getClass(), mod.defaultPage, mod); ConfigCore.oneConfigMods.add(mod); + this.mod = mod; } /** @@ -155,4 +160,12 @@ public class Config { } } } + + /** + * Function to open the gui of this mod + */ + public void openGui() { + if (mod == null) return; + Minecraft.getMinecraft().displayGuiScreen(new OneConfigGui(new ModConfigPage(mod.defaultPage))); + } } -- cgit