aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
diff options
context:
space:
mode:
authornextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com>2022-05-01 12:36:56 +0100
committernextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com>2022-05-01 12:36:56 +0100
commit9694fd2bf0aa538652b9c65472c5f2017efce195 (patch)
treea8c9dba6e4dd5359dd01942cba47fd54c84d452b /src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
parent60f1c29872465a25be4f2c4ca8c5eb1abf69f988 (diff)
parentfb9d2f2633c185faba162d85e4ae71c2a347fbb5 (diff)
downloadOneConfig-9694fd2bf0aa538652b9c65472c5f2017efce195.tar.gz
OneConfig-9694fd2bf0aa538652b9c65472c5f2017efce195.tar.bz2
OneConfig-9694fd2bf0aa538652b9c65472c5f2017efce195.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java13
1 files changed, 13 insertions, 0 deletions
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 35b299b..2af4357 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;
}
/**
@@ -157,4 +162,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)));
+ }
}