aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/config
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-01 11:23:06 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-01 11:23:06 +0200
commitfe8261cf7c10af90c0154633a6a8f18b3e5bfb12 (patch)
tree0435f70db77ef7c965211a3d4d577ffe978334e6 /src/main/java/io/polyfrost/oneconfig/config
parent5514e4b97ab2a7a37bf25cf4a4a57baf8f94e052 (diff)
downloadOneConfig-fe8261cf7c10af90c0154633a6a8f18b3e5bfb12.tar.gz
OneConfig-fe8261cf7c10af90c0154633a6a8f18b3e5bfb12.tar.bz2
OneConfig-fe8261cf7c10af90c0154633a6a8f18b3e5bfb12.zip
icons sidebar, categories in config, fix some other issues
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/config')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java2
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/data/OptionType.java6
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java13
3 files changed, 20 insertions, 1 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java b/src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java
index fe61a02..7a0b6c1 100644
--- a/src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java
+++ b/src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java
@@ -24,7 +24,7 @@ public @interface Option {
/**
* The category of the component
*/
- String category() default "general";
+ String category() default "General";
/**
* The subcategory of the component (displayed as header)
diff --git a/src/main/java/io/polyfrost/oneconfig/config/data/OptionType.java b/src/main/java/io/polyfrost/oneconfig/config/data/OptionType.java
index 7e106f4..8376786 100644
--- a/src/main/java/io/polyfrost/oneconfig/config/data/OptionType.java
+++ b/src/main/java/io/polyfrost/oneconfig/config/data/OptionType.java
@@ -9,7 +9,13 @@ public enum OptionType {
* Type: boolean
*/
CHECKBOX,
+ /**
+ * Type: boolean
+ */
DUAL_OPTION,
+ /**
+ * Type: int
+ */
UNI_SELECTOR,
/**
* Type: String
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)));
+ }
}