diff options
author | nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> | 2022-06-05 10:39:49 +0100 |
---|---|---|
committer | nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> | 2022-06-05 10:39:49 +0100 |
commit | 17826161c67f6adf5976d7993ac0a229193e2eb6 (patch) | |
tree | f4172013d2db0986f0bb123040be1dc5b5823b3d /src/main/java/cc/polyfrost/oneconfig/config | |
parent | 087f5404658a1543834f16a89e3436f8399297f6 (diff) | |
parent | 72c024213e7c61411ce12f6032f8ef0659408c3a (diff) | |
download | OneConfig-17826161c67f6adf5976d7993ac0a229193e2eb6.tar.gz OneConfig-17826161c67f6adf5976d7993ac0a229193e2eb6.tar.bz2 OneConfig-17826161c67f6adf5976d7993ac0a229193e2eb6.zip |
Merge remote-tracking branch 'origin/master'
# Conflicts:
# src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
# src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuad.java
# src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
# src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
# src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
# src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java
# src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
# src/main/java/cc/polyfrost/oneconfig/utils/GuiUtils.java
# src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Command.java
# src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/ArgumentParser.java
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/config')
8 files changed, 37 insertions, 43 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java b/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java index faeffff..b867bc0 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java @@ -14,18 +14,10 @@ import java.util.ArrayList; public class OneConfigConfig extends Config { - public static String currentProfile = "Default Profile"; - public static ArrayList<String> favoriteMods = new ArrayList<>(); - public static ArrayList<OneColor> favoriteColors = new ArrayList<>(); - public static ArrayList<OneColor> recentColors = new ArrayList<>(); - - // the color library public static final int TRANSPARENT = new Color(0, 0, 0, 0).getRGB(); // Transparent - public static final int BLACK = new Color(0, 0, 0, 255).getRGB(); // Black public static final int GRAY_900 = new Color(13, 14, 15, 255).getRGB(); // Gray 900 - public static final int GRAY_900_80 = new Color(13, 14, 15, 204).getRGB(); // Gray 900 80% public static final int GRAY_800 = new Color(21, 22, 23, 255).getRGB(); // Gray 800 public static final int GRAY_800_95 = new Color(21, 22, 23, 242).getRGB(); @@ -59,8 +51,10 @@ public class OneConfigConfig extends Config { public static final int ERROR_800_80 = new Color(145, 24, 24, 204).getRGB(); // Red 800 public static final int ERROR_300 = new Color(253, 155, 155).getRGB(); public static final int ERROR_300_80 = new Color(253, 155, 155, 204).getRGB(); - - + public static String currentProfile = "Default Profile"; + public static ArrayList<String> favoriteMods = new ArrayList<>(); + public static ArrayList<OneColor> favoriteColors = new ArrayList<>(); + public static ArrayList<OneColor> recentColors = new ArrayList<>(); public static boolean ROUNDED_CORNERS = true; public static float CORNER_RADIUS_WIN = 20f; public static float CORNER_RADIUS = 12f; diff --git a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java index 3115f3a..fa4f058 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java @@ -168,8 +168,8 @@ public class VigilanceConfig extends Config { } private static class CompatConfigColorElement extends ConfigColorElement { - private Color prevColor = null; private final Field color; + private Color prevColor = null; private OneColor cachedColor = null; public CompatConfigColorElement(Field color, Vigilant parent, String name, int size) { diff --git a/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java b/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java index dbec72a..9ed1cd9 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java @@ -97,6 +97,27 @@ public final class OneColor { // accessors /** + * Get the RGBA color from the HSB color, and apply the alpha. + */ + public static int HSBAtoRGBA(float hue, float saturation, float brightness, int alpha) { + int temp = Color.HSBtoRGB(hue / 360f, saturation / 100f, brightness / 100f); + return ((temp & 0x00ffffff) | (alpha << 24)); + } + + /** + * Get the HSBA color from the RGBA color. + */ + public static short[] RGBAtoHSBA(int rgba) { + short[] hsb = new short[4]; + float[] hsbArray = Color.RGBtoHSB((rgba >> 16 & 255), (rgba >> 8 & 255), (rgba & 255), null); + hsb[0] = (short) (hsbArray[0] * 360); + hsb[1] = (short) (hsbArray[1] * 100); + hsb[2] = (short) (hsbArray[2] * 100); + hsb[3] = (short) (rgba >> 24 & 255); + return hsb; + } + + /** * Get the red value of the color (0-255). */ public int getRed() { @@ -145,6 +166,11 @@ public final class OneColor { return hsba[3]; } + public void setAlpha(int alpha) { + this.hsba[3] = (short) alpha; + rgba = HSBAtoRGBA(this.hsba[0], this.hsba[1], this.hsba[2], this.hsba[3]); + } + /** * Get the chroma speed of the color (1s-30s). */ @@ -221,27 +247,6 @@ public final class OneColor { } } - /** - * Get the RGBA color from the HSB color, and apply the alpha. - */ - public static int HSBAtoRGBA(float hue, float saturation, float brightness, int alpha) { - int temp = Color.HSBtoRGB(hue / 360f, saturation / 100f, brightness / 100f); - return ((temp & 0x00ffffff) | (alpha << 24)); - } - - /** - * Get the HSBA color from the RGBA color. - */ - public static short[] RGBAtoHSBA(int rgba) { - short[] hsb = new short[4]; - float[] hsbArray = Color.RGBtoHSB((rgba >> 16 & 255), (rgba >> 8 & 255), (rgba & 255), null); - hsb[0] = (short) (hsbArray[0] * 360); - hsb[1] = (short) (hsbArray[1] * 100); - hsb[2] = (short) (hsbArray[2] * 100); - hsb[3] = (short) (rgba >> 24 & 255); - return hsb; - } - public String getHex() { return Integer.toHexString(0xff000000 | getRGB()).toUpperCase().substring(2); } @@ -273,11 +278,6 @@ public final class OneColor { hsba = RGBAtoHSBA(rgba); } - public void setAlpha(int alpha) { - this.hsba[3] = (short) alpha; - rgba = HSBAtoRGBA(this.hsba[0], this.hsba[1], this.hsba[2], this.hsba[3]); - } - private String charsToString(char... chars) { StringBuilder sb = new StringBuilder(); for (char c : chars) { diff --git a/src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java b/src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java index d62247c..d455411 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java @@ -1,6 +1,6 @@ package cc.polyfrost.oneconfig.config.core; -import cc.polyfrost.oneconfig.libs.universal.UKeyboard; +import gg.essential.universal.UKeyboard; import java.util.ArrayList; diff --git a/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java b/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java index 7849124..241dca7 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java @@ -9,8 +9,8 @@ public class Mod { public final ModType modType; public final String modIcon; public final Migrator migrator; - public Config config; public final OptionPage defaultPage; + public Config config; public boolean isShortCut = false; /** diff --git a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/BasicOption.java b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/BasicOption.java index 6fa3254..d4b4498 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/BasicOption.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/BasicOption.java @@ -5,11 +5,11 @@ import java.util.function.Supplier; @SuppressWarnings({"unused"}) public abstract class BasicOption { + public final int size; protected final Field field; protected final String name; - public final int size; - private Supplier<Boolean> dependency; protected final Object parent; + private Supplier<Boolean> dependency; /** * Initialize option diff --git a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java index 531c374..8eb5eb1 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java @@ -22,10 +22,10 @@ import java.util.*; import java.util.function.Supplier; public class Config { + public final transient HashMap<String, BasicOption> optionNames = new HashMap<>(); transient protected final String configFile; transient protected final Gson gson = new GsonBuilder().excludeFieldsWithModifiers(Modifier.TRANSIENT).setPrettyPrinting().create(); transient public Mod mod; - public final transient HashMap<String, BasicOption> optionNames = new HashMap<>(); public transient boolean hasBeenInitialized = false; public boolean enabled = true; diff --git a/src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java b/src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java index 5573a3e..b45aeba 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java @@ -14,8 +14,8 @@ public class VigilanceMigrator implements Migrator { private static final Pattern booleanPattern = Pattern.compile("\"?(?<name>[^\\s\"]+)\"? = (?<value>true|false)"); private static final Pattern numberPattern = Pattern.compile("\"?(?<name>[^\\s\"]+)\"? = (?<value>[\\d.]+)"); private static final Pattern stringPattern = Pattern.compile("\"?(?<name>[^\\s\"]+)\"? = \"(?<value>.+)\""); - protected HashMap<String, HashMap<String, HashMap<String, Object>>> values = null; protected final String filePath; + protected HashMap<String, HashMap<String, HashMap<String, Object>>> values = null; public VigilanceMigrator(String filePath) { this.filePath = filePath; |