aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/command/OneConfigCommand.java9
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/annotations/VigilanceName.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java8
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilantAccessor.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java74
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/data/OptionCategory.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/data/OptionType.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java11
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java16
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/ModUpdateCard.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigButton.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/hud/BasicHud.java11
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java258
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java82
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/image/Images.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/image/SVGs.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/Scissor.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java21
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/plugin/OneConfigMixinPlugin.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/plugin/asm/ITransformer.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/ColorUtils.java73
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/GuiUtils.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/IOUtils.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java9
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/JsonUtils.java8
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java8
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/NetworkUtils.java22
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/TextUtils.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/TickDelay.java6
47 files changed, 555 insertions, 161 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/command/OneConfigCommand.java b/src/main/java/cc/polyfrost/oneconfig/command/OneConfigCommand.java
index 4ea67d9..0743b54 100644
--- a/src/main/java/cc/polyfrost/oneconfig/command/OneConfigCommand.java
+++ b/src/main/java/cc/polyfrost/oneconfig/command/OneConfigCommand.java
@@ -3,8 +3,7 @@ package cc.polyfrost.oneconfig.command;
import cc.polyfrost.oneconfig.gui.HudGui;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.test.TestNanoVGGui;
-import cc.polyfrost.oneconfig.utils.TickDelay;
-import cc.polyfrost.oneconfig.libs.universal.UScreen;
+import cc.polyfrost.oneconfig.utils.GuiUtils;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
@@ -33,14 +32,14 @@ public class OneConfigCommand extends CommandBase {
@Override
public void processCommand(ICommandSender sender, String[] args) {
- if (args.length == 0) new TickDelay(() -> UScreen.displayScreen(OneConfigGui.create()), 1);
+ if (args.length == 0) GuiUtils.displayScreen(OneConfigGui.create());
else {
switch (args[0]) {
case "hud":
- new TickDelay(() -> UScreen.displayScreen(new HudGui()), 1);
+ GuiUtils.displayScreen(new HudGui());
break;
case "lwjgl":
- new TickDelay(() -> UScreen.displayScreen(new TestNanoVGGui()), 1);
+ GuiUtils.displayScreen(new TestNanoVGGui());
break;
case "destroy":
OneConfigGui.instanceToRestore = null;
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/annotations/VigilanceName.java b/src/main/java/cc/polyfrost/oneconfig/config/annotations/VigilanceName.java
index 03e94af..e4b042a 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/annotations/VigilanceName.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/annotations/VigilanceName.java
@@ -9,6 +9,8 @@ import java.lang.annotation.Target;
@Target(ElementType.FIELD)
public @interface VigilanceName {
String name();
+
String category();
+
String subcategory();
}
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 f31b609..0fbfa62 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java
@@ -20,6 +20,10 @@ import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Objects;
+/**
+ * This class is used to convert the Vigilance config to the new config system.
+ * It is not meant to be used outside the config system.
+ */
public class VigilanceConfig extends Config {
public final Vigilant vigilant;
@@ -133,7 +137,7 @@ public class VigilanceConfig extends Config {
PropertyAttributesExt.class.getDeclaredField("i18nName").setAccessible(true);
return I18n.format((String) PropertyAttributesExt.class.getDeclaredField("i18nName").get(ext));
} catch (IllegalAccessException | NoSuchFieldException e) {
- return ext.getName();
+ return ext.getName();
}
}
@@ -151,7 +155,7 @@ public class VigilanceConfig extends Config {
PropertyAttributesExt.class.getDeclaredField("i18nSubcategory").setAccessible(true);
return I18n.format((String) PropertyAttributesExt.class.getDeclaredField("i18nSubcategory").get(ext));
} catch (IllegalAccessException | NoSuchFieldException e) {
- return ext.getSubcategory();
+ return ext.getSubcategory();
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilantAccessor.java b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilantAccessor.java
index 4c79a21..ca2b1da 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilantAccessor.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilantAccessor.java
@@ -2,6 +2,10 @@ package cc.polyfrost.oneconfig.config.compatibility;
import gg.essential.vigilance.data.PropertyCollector;
+/**
+ * Interface for accessing the {@link PropertyCollector} in a Vigilant config.
+ * <p>Not recommended for non-internal OneConfig usage, as Systemless will get really angry at us</p>
+ */
public interface VigilantAccessor {
PropertyCollector getPropertyCollector();
}
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 3f6289e..8135ac0 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java
@@ -5,7 +5,7 @@ import org.jetbrains.annotations.NotNull;
import java.awt.*;
/**
- * OneColor is a class for storing Colors in HSBA format. This format is used to allow the color selectors to work correctly.
+ * OneColor is a class for storing colors in HSBA format. This format is used to allow the color selectors to work correctly.
* <p>
* <code>
* short[0] = hue (0-360)
@@ -71,11 +71,14 @@ public final class OneColor {
}
// chroma constructors
- /** Create a new Chroma OneColor. The speed should be a max of 30s and a min of 1s. */
+
+ /**
+ * Create a new Chroma OneColor. The speed should be a max of 30s and a min of 1s.
+ */
public OneColor(int saturation, int brightness, int alpha, float chromaSpeed) {
this(System.currentTimeMillis() % (int) chromaSpeed / chromaSpeed, saturation, brightness, alpha);
- if(chromaSpeed < 1) chromaSpeed = 1;
- if(chromaSpeed > 30) chromaSpeed = 30;
+ if (chromaSpeed < 1) chromaSpeed = 1;
+ if (chromaSpeed > 30) chromaSpeed = 30;
this.dataBit = (int) chromaSpeed;
}
@@ -92,58 +95,79 @@ public final class OneColor {
// accessors
- /** Get the red value of the color (0-255). */
+
+ /**
+ * Get the red value of the color (0-255).
+ */
public int getRed() {
return rgba >> 16 & 255;
}
- /** Get the green value of the color (0-255). */
+ /**
+ * Get the green value of the color (0-255).
+ */
public int getGreen() {
return rgba >> 8 & 255;
}
- /** Get the blue value of the color (0-255). */
+ /**
+ * Get the blue value of the color (0-255).
+ */
public int getBlue() {
return rgba & 255;
}
- /** Get the hue value of the color (0-360). */
+ /**
+ * Get the hue value of the color (0-360).
+ */
public int getHue() {
return hsba[0];
}
- /** Get the saturation value of the color (0-100). */
+ /**
+ * Get the saturation value of the color (0-100).
+ */
public int getSaturation() {
return hsba[1];
}
- /** Get the brightness value of the color (0-100). */
+ /**
+ * Get the brightness value of the color (0-100).
+ */
public int getBrightness() {
return hsba[2];
}
- /** Get the alpha value of the color (0-255). */
+ /**
+ * Get the alpha value of the color (0-255).
+ */
public int getAlpha() {
return hsba[3];
}
- /** Get the chroma speed of the color (1s-30s). */
+ /**
+ * Get the chroma speed of the color (1s-30s).
+ */
public int getDataBit() {
return dataBit == -1 ? -1 : dataBit / 1000;
}
- /** Set the current chroma speed of the color. -1 to disable. */
+ /**
+ * Set the current chroma speed of the color. -1 to disable.
+ */
public void setChromaSpeed(int speed) {
- if(speed == -1) {
+ if (speed == -1) {
this.dataBit = -1;
return;
}
- if(speed < 1) speed = 1;
- if(speed > 30) speed = 30;
+ if (speed < 1) speed = 1;
+ if (speed > 30) speed = 30;
this.dataBit = speed * 1000;
}
- /** Set the HSBA values of the color. */
+ /**
+ * Set the HSBA values of the color.
+ */
public void setHSBA(int hue, int saturation, int brightness, int alpha) {
this.hsba[0] = (short) hue;
this.hsba[1] = (short) saturation;
@@ -217,16 +241,16 @@ public final class OneColor {
public void setColorFromHex(String hex) {
hex = hex.replace("#", "");
- if(hex.length() > 6) {
+ if (hex.length() > 6) {
hex = hex.substring(0, 6);
}
- if(hex.length() == 3) {
+ if (hex.length() == 3) {
hex = charsToString(hex.charAt(0), hex.charAt(0), hex.charAt(1), hex.charAt(1), hex.charAt(2), hex.charAt(2));
}
- if(hex.length() == 1) {
+ if (hex.length() == 1) {
hex = charsToString(hex.charAt(0), hex.charAt(0), hex.charAt(0), hex.charAt(0), hex.charAt(0), hex.charAt(0));
}
- if(hex.length() == 2 && hex.charAt(1) == hex.charAt(0)) {
+ if (hex.length() == 2 && hex.charAt(1) == hex.charAt(0)) {
hex = charsToString(hex.charAt(0), hex.charAt(0), hex.charAt(0), hex.charAt(0), hex.charAt(0), hex.charAt(0));
}
StringBuilder hexBuilder = new StringBuilder(hex);
@@ -235,9 +259,9 @@ public final class OneColor {
}
hex = hexBuilder.toString();
//System.out.println(hex);
- int r = Integer.valueOf(hex.substring( 0, 2 ), 16);
- int g = Integer.valueOf( hex.substring( 2, 4 ), 16);
- int b = Integer.valueOf( hex.substring( 4, 6 ), 16);
+ int r = Integer.valueOf(hex.substring(0, 2), 16);
+ int g = Integer.valueOf(hex.substring(2, 4), 16);
+ int b = Integer.valueOf(hex.substring(4, 6), 16);
this.rgba = ((getAlpha() & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | ((b & 0xFF));
hsba = RGBAtoHSBA(rgba);
}
@@ -249,7 +273,7 @@ public final class OneColor {
private String charsToString(char... chars) {
StringBuilder sb = new StringBuilder();
- for(char c : chars) {
+ for (char c : chars) {
sb.append(c);
}
return sb.toString();
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/data/OptionCategory.java b/src/main/java/cc/polyfrost/oneconfig/config/data/OptionCategory.java
index 363cfda..76b2b34 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/data/OptionCategory.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/data/OptionCategory.java
@@ -1,10 +1,6 @@
package cc.polyfrost.oneconfig.config.data;
-import cc.polyfrost.oneconfig.config.interfaces.BasicOption;
-import cc.polyfrost.oneconfig.gui.elements.config.ConfigPageButton;
-
import java.util.ArrayList;
-import java.util.LinkedHashMap;
public class OptionCategory {
public final ArrayList<OptionSubcategory> subcategories = new ArrayList<>();
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/data/OptionType.java b/src/main/java/cc/polyfrost/oneconfig/config/data/OptionType.java
index 519e890..10c9a6b 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/data/OptionType.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/data/OptionType.java
@@ -48,7 +48,7 @@ public enum OptionType {
BUTTON,
/**
* Type: OneKeyBind
- */
+ */
KEYBIND,
/**
* Type: ? extends BasicHud
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 a9d1d1e..f495ecd 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java
@@ -4,15 +4,14 @@ import cc.polyfrost.oneconfig.config.annotations.ConfigPage;
import cc.polyfrost.oneconfig.config.annotations.Option;
import cc.polyfrost.oneconfig.config.core.ConfigCore;
import cc.polyfrost.oneconfig.config.data.*;
-import cc.polyfrost.oneconfig.config.migration.Migrator;
import cc.polyfrost.oneconfig.config.profiles.Profiles;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.gui.elements.config.*;
import cc.polyfrost.oneconfig.gui.pages.ModConfigPage;
import cc.polyfrost.oneconfig.hud.BasicHud;
import cc.polyfrost.oneconfig.hud.HudCore;
+import cc.polyfrost.oneconfig.utils.GuiUtils;
import com.google.gson.*;
-import cc.polyfrost.oneconfig.libs.universal.UScreen;
import java.io.*;
import java.lang.reflect.Field;
@@ -247,7 +246,7 @@ public class Config {
*/
public void openGui() {
if (mod == null) return;
- UScreen.displayScreen(new OneConfigGui(new ModConfigPage(mod.defaultPage)));
+ GuiUtils.displayScreen(new OneConfigGui(new ModConfigPage(mod.defaultPage)));
}
/**
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java b/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java
index 4eafd6d..dfc5e16 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java
@@ -1,7 +1,7 @@
package cc.polyfrost.oneconfig.config.profiles;
-import cc.polyfrost.oneconfig.config.OneConfigConfig;
import cc.polyfrost.oneconfig.OneConfig;
+import cc.polyfrost.oneconfig.config.OneConfigConfig;
import cc.polyfrost.oneconfig.config.core.ConfigCore;
import org.apache.commons.io.FileUtils;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
index 4595725..e94ef44 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
@@ -3,10 +3,10 @@ package cc.polyfrost.oneconfig.gui;
import cc.polyfrost.oneconfig.config.core.ConfigCore;
import cc.polyfrost.oneconfig.hud.BasicHud;
import cc.polyfrost.oneconfig.hud.HudCore;
-import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.libs.universal.UKeyboard;
import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
import cc.polyfrost.oneconfig.libs.universal.UScreen;
+import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
index df35ee0..5194f83 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
@@ -1,19 +1,19 @@
package cc.polyfrost.oneconfig.gui;
import cc.polyfrost.oneconfig.config.OneConfigConfig;
+import cc.polyfrost.oneconfig.config.core.OneColor;
import cc.polyfrost.oneconfig.gui.elements.BasicElement;
import cc.polyfrost.oneconfig.gui.elements.ColorSelector;
import cc.polyfrost.oneconfig.gui.elements.text.TextInputField;
import cc.polyfrost.oneconfig.gui.pages.HomePage;
import cc.polyfrost.oneconfig.gui.pages.Page;
-import cc.polyfrost.oneconfig.config.core.OneColor;
+import cc.polyfrost.oneconfig.libs.universal.*;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager;
import cc.polyfrost.oneconfig.utils.InputUtils;
import cc.polyfrost.oneconfig.utils.MathUtils;
-import cc.polyfrost.oneconfig.libs.universal.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.input.Mouse;
@@ -243,7 +243,7 @@ public class OneConfigGui extends UScreen {
}
public OneColor getColor() {
- if(currentColorSelector == null) return null;
+ if (currentColorSelector == null) return null;
return currentColorSelector.getColor();
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
index 5729de3..51e5a66 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
@@ -8,13 +8,14 @@ import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
import cc.polyfrost.oneconfig.utils.ColorUtils;
+import cc.polyfrost.oneconfig.utils.GuiUtils;
import cc.polyfrost.oneconfig.utils.MathUtils;
-import cc.polyfrost.oneconfig.libs.universal.UScreen;
import java.util.ArrayList;
import java.util.List;
-import static cc.polyfrost.oneconfig.gui.elements.BasicButton.*;
+import static cc.polyfrost.oneconfig.gui.elements.BasicButton.ALIGNMENT_LEFT;
+import static cc.polyfrost.oneconfig.gui.elements.BasicButton.SIZE_36;
public class SideBar {
private final List<BasicButton> btnList = new ArrayList<>();
@@ -37,11 +38,11 @@ public class SideBar {
btnList.add(new BasicButton(192, SIZE_36, "Packs Library", SVGs.BOX, null, ALIGNMENT_LEFT, ColorUtils.TERTIARY));
btnList.add(new BasicButton(192, SIZE_36, "Packs Browser", SVGs.SEARCH, null, ALIGNMENT_LEFT, ColorUtils.TERTIARY));
btnList.add(new BasicButton(192, SIZE_36, "Close", SVGs.X_CIRCLE, null, ALIGNMENT_LEFT, ColorUtils.SECONDARY_TRANSPARENT));
- btnList.get(12).setClickAction(() -> UScreen.displayScreen(null));
+ btnList.get(12).setClickAction(() -> GuiUtils.displayScreen(null));
btnList.add(new BasicButton(192, SIZE_36, "Minimize", SVGs.MINIMISE, null, ALIGNMENT_LEFT, ColorUtils.SECONDARY_TRANSPARENT));
- btnList.get(13).setClickAction(() -> UScreen.displayScreen(null));
+ btnList.get(13).setClickAction(() -> GuiUtils.displayScreen(null));
btnList.add(new BasicButton(192, SIZE_36, "Edit HUD", SVGs.HUD, null, ALIGNMENT_LEFT, ColorUtils.SECONDARY_TRANSPARENT));
- btnList.get(14).setClickAction(() -> UScreen.displayScreen(new HudGui()));
+ btnList.get(14).setClickAction(() -> GuiUtils.displayScreen(new HudGui()));
}
public void draw(long vg, int x, int y) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
index 579841e..a84c290 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
@@ -89,7 +89,7 @@ public class BasicButton extends BasicElement {
contentWidth += RenderManager.getTextWidth(vg, text, fontSize, Fonts.MEDIUM);
}
if (alignment == ALIGNMENT_CENTER) {
- if(icon1 != null && icon2 == null && text == null) {
+ if (icon1 != null && icon2 == null && text == null) {
RenderManager.drawSvg(vg, icon1, middle - iconSize / 2f, middleYIcon, iconSize, iconSize);
this.update(x, y);
return;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
index f6c9e35..8b86827 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
@@ -1,6 +1,5 @@
package cc.polyfrost.oneconfig.gui.elements;
-import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.utils.ColorUtils;
import cc.polyfrost.oneconfig.utils.InputUtils;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java
index 4e04f5c..c734ccb 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java
@@ -11,8 +11,8 @@ import cc.polyfrost.oneconfig.lwjgl.image.Images;
import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
import cc.polyfrost.oneconfig.utils.ColorUtils;
import cc.polyfrost.oneconfig.utils.InputUtils;
-import cc.polyfrost.oneconfig.utils.NetworkUtils;
import cc.polyfrost.oneconfig.utils.MathUtils;
+import cc.polyfrost.oneconfig.utils.NetworkUtils;
import org.lwjgl.input.Mouse;
import java.awt.*;
@@ -23,7 +23,7 @@ import java.util.ArrayList;
public class ColorSelector {
private int x;
private int y;
- private OneColor color;
+ private final OneColor color;
private float percentMove = 0f;
private int mouseX, mouseY;
private final ArrayList<BasicElement> buttons = new ArrayList<>();
@@ -66,7 +66,7 @@ public class ColorSelector {
hexInput.setInput(color.getHex());
this.x = mouseX - 208;
this.y = Math.max(0, mouseY - 776);
- if(color.getDataBit() != -1) mode = 2;
+ if (color.getDataBit() != -1) mode = 2;
if (mode == 0 || mode == 2) {
this.mouseX = (int) (color.getSaturation() / 100f * 384 + x + 16);
this.mouseY = (int) (Math.abs(color.getBrightness() / 100f - 1f) * 288 + y + 120);
@@ -106,7 +106,7 @@ public class ColorSelector {
RenderManager.drawHollowRoundRect(vg, x - 3, y - 3, width + 4, height + 4, new Color(204, 204, 204, 77).getRGB(), 20f, 2f);
RenderManager.drawRoundedRect(vg, x, y, width, height, OneConfigConfig.GRAY_800, 20f);
RenderManager.drawString(vg, "Color Selector", x + 16, y + 32, OneConfigConfig.WHITE_90, 18f, Fonts.SEMIBOLD);
- if(!closeBtn.isHovered()) RenderManager.setAlpha(vg, 0.8f);
+ if (!closeBtn.isHovered()) RenderManager.setAlpha(vg, 0.8f);
closeBtn.draw(vg, x + 368, y + 16);
RenderManager.drawSvg(vg, SVGs.X_CIRCLE, x + 368, y + 16, 32, 32, closeBtn.isHovered() ? OneConfigConfig.ERROR_600 : -1);
RenderManager.setAlpha(vg, 1f);
@@ -140,10 +140,10 @@ public class ColorSelector {
// TODO favorite stuff
faveBtn.draw(vg, x + 16, y + 672);
recentBtn.draw(vg, x + 16, y + 720);
- for(int i = 0; i < 7; i++) {
+ for (int i = 0; i < 7; i++) {
favoriteColors.get(i).draw(vg, x + 104 + i * 44, y + 672);
}
- for(int i = 0; i < 7; i++) {
+ for (int i = 0; i < 7; i++) {
recentColors.get(i).draw(vg, x + 104 + i * 44, y + 720);
}
@@ -318,7 +318,7 @@ public class ColorSelector {</