aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/config')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/annotations/ConfigPage.java2
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java2
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/data/OptionCategory.java4
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/data/OptionPage.java5
-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
6 files changed, 25 insertions, 7 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/config/annotations/ConfigPage.java b/src/main/java/io/polyfrost/oneconfig/config/annotations/ConfigPage.java
index fecd438..c0a4169 100644
--- a/src/main/java/io/polyfrost/oneconfig/config/annotations/ConfigPage.java
+++ b/src/main/java/io/polyfrost/oneconfig/config/annotations/ConfigPage.java
@@ -28,5 +28,5 @@ public @interface ConfigPage {
/**
* The category of the page
*/
- String category() default "general";
+ String category() default "General";
}
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 05505a9..a4f4a67 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/OptionCategory.java b/src/main/java/io/polyfrost/oneconfig/config/data/OptionCategory.java
index 15c073c..a3752bb 100644
--- a/src/main/java/io/polyfrost/oneconfig/config/data/OptionCategory.java
+++ b/src/main/java/io/polyfrost/oneconfig/config/data/OptionCategory.java
@@ -4,10 +4,10 @@ import io.polyfrost.oneconfig.config.interfaces.BasicOption;
import io.polyfrost.oneconfig.gui.elements.config.ConfigPageButton;
import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
public class OptionCategory {
- public final HashMap<String, ArrayList<BasicOption>> subcategories = new HashMap<>();
+ public final LinkedHashMap<String, ArrayList<BasicOption>> subcategories = new LinkedHashMap<>();
public final ArrayList<ConfigPageButton> topPages = new ArrayList<>();
public final ArrayList<ConfigPageButton> bottomPages = new ArrayList<>();
}
diff --git a/src/main/java/io/polyfrost/oneconfig/config/data/OptionPage.java b/src/main/java/io/polyfrost/oneconfig/config/data/OptionPage.java
index 12aef6a..8103404 100644
--- a/src/main/java/io/polyfrost/oneconfig/config/data/OptionPage.java
+++ b/src/main/java/io/polyfrost/oneconfig/config/data/OptionPage.java
@@ -1,7 +1,6 @@
package io.polyfrost.oneconfig.config.data;
-
-import java.util.HashMap;
+import java.util.LinkedHashMap;
public class OptionPage {
public final String name;
@@ -11,7 +10,7 @@ public class OptionPage {
* Depth 2 = subcategories
* Depth 3 = list of options
*/
- public final HashMap<String, OptionCategory> categories = new HashMap<>();
+ public final LinkedHashMap<String, OptionCategory> categories = new LinkedHashMap<>();
public OptionPage(String name, Mod mod) {
this.name = name;
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 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)));
+ }
}