From 087f5404658a1543834f16a89e3436f8399297f6 Mon Sep 17 00:00:00 2001
From: nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com>
Date: Sun, 5 Jun 2022 10:36:43 +0100
Subject: Reformat code and OC-38
---
.../oneconfig/events/event/ReceivePacketEvent.java | 1 +
.../oneconfig/events/event/SendPacketEvent.java | 1 +
.../cc/polyfrost/oneconfig/gui/OneConfigGui.java | 8 +++--
.../oneconfig/gui/animations/ColorAnimation.java | 15 +++++++-
.../oneconfig/gui/animations/DummyAnimation.java | 2 +-
.../oneconfig/gui/animations/EaseInOutQuad.java | 5 +--
.../oneconfig/gui/animations/EaseInOutQuart.java | 5 +--
.../oneconfig/gui/elements/BasicButton.java | 18 ++++++----
.../oneconfig/gui/elements/BasicElement.java | 41 ++++++++++++++++++++++
.../oneconfig/gui/elements/ColorSelector.java | 5 ++-
.../polyfrost/oneconfig/gui/elements/ModCard.java | 2 +-
.../gui/elements/config/ConfigColorElement.java | 4 +--
.../gui/elements/config/ConfigDropdown.java | 5 ++-
.../gui/elements/config/ConfigDualOption.java | 5 +--
.../gui/elements/config/ConfigPageButton.java | 2 +-
.../gui/elements/config/ConfigSwitch.java | 4 +--
.../gui/elements/text/NumberInputField.java | 3 +-
.../cc/polyfrost/oneconfig/gui/pages/ModsPage.java | 4 +--
.../cc/polyfrost/oneconfig/gui/pages/Page.java | 2 --
.../cc/polyfrost/oneconfig/init/OneConfigInit.java | 1 +
.../oneconfig/lwjgl/image/ImageLoader.java | 17 ++++-----
.../oneconfig/lwjgl/scissor/ScissorManager.java | 13 ++++---
.../oneconfig/mixin/FontRendererMixin.java | 15 ++++++++
.../polyfrost/oneconfig/mixin/MinecraftMixin.java | 3 +-
.../polyfrost/oneconfig/test/ButtonTestPage.java | 35 ++++++++++++------
.../cc/polyfrost/oneconfig/test/TestConfig.java | 1 -
.../cc/polyfrost/oneconfig/utils/GuiUtils.java | 9 +++--
.../cc/polyfrost/oneconfig/utils/InputUtils.java | 15 ++++----
.../cc/polyfrost/oneconfig/utils/JsonUtils.java | 2 +-
.../polyfrost/oneconfig/utils/Multithreading.java | 4 +--
.../cc/polyfrost/oneconfig/utils/NetworkUtils.java | 20 ++++++-----
.../cc/polyfrost/oneconfig/utils/TextUtils.java | 14 ++++----
.../oneconfig/utils/color/ColorUtils.java | 2 +-
.../oneconfig/utils/commands/CommandManager.java | 1 -
.../utils/commands/annotations/Command.java | 2 +-
.../oneconfig/utils/commands/annotations/Main.java | 1 +
.../oneconfig/utils/commands/annotations/Name.java | 1 +
.../utils/commands/annotations/SubCommand.java | 3 ++
.../utils/commands/arguments/ArgumentParser.java | 4 ++-
.../oneconfig/utils/hypixel/HypixelUtils.java | 3 ++
40 files changed, 208 insertions(+), 90 deletions(-)
create mode 100644 src/main/java/cc/polyfrost/oneconfig/mixin/FontRendererMixin.java
(limited to 'src/main/java/cc/polyfrost')
diff --git a/src/main/java/cc/polyfrost/oneconfig/events/event/ReceivePacketEvent.java b/src/main/java/cc/polyfrost/oneconfig/events/event/ReceivePacketEvent.java
index 274f7a4..17bc16d 100644
--- a/src/main/java/cc/polyfrost/oneconfig/events/event/ReceivePacketEvent.java
+++ b/src/main/java/cc/polyfrost/oneconfig/events/event/ReceivePacketEvent.java
@@ -4,6 +4,7 @@ import net.minecraft.network.Packet;
public class ReceivePacketEvent extends CancellableEvent {
public final Packet> packet;
+
public ReceivePacketEvent(Packet> packet) {
this.packet = packet;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/events/event/SendPacketEvent.java b/src/main/java/cc/polyfrost/oneconfig/events/event/SendPacketEvent.java
index f149d59..3cee784 100644
--- a/src/main/java/cc/polyfrost/oneconfig/events/event/SendPacketEvent.java
+++ b/src/main/java/cc/polyfrost/oneconfig/events/event/SendPacketEvent.java
@@ -4,6 +4,7 @@ import net.minecraft.network.Packet;
public class SendPacketEvent extends CancellableEvent {
public final Packet> packet;
+
public SendPacketEvent(Packet> packet) {
this.packet = packet;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
index 5985d12..8db7640 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
@@ -9,14 +9,17 @@ import cc.polyfrost.oneconfig.gui.elements.ColorSelector;
import cc.polyfrost.oneconfig.gui.elements.text.TextInputField;
import cc.polyfrost.oneconfig.gui.pages.ModsPage;
import cc.polyfrost.oneconfig.gui.pages.Page;
-import cc.polyfrost.oneconfig.libs.universal.*;
+import cc.polyfrost.oneconfig.libs.universal.UKeyboard;
+import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
+import cc.polyfrost.oneconfig.libs.universal.UResolution;
+import cc.polyfrost.oneconfig.libs.universal.UScreen;
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.GuiUtils;
-import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import cc.polyfrost.oneconfig.utils.InputUtils;
+import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.input.Mouse;
@@ -64,6 +67,7 @@ public class OneConfigGui extends UScreen {
public void onDrawScreen(@NotNull UMatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
super.onDrawScreen(matrixStack, mouseX, mouseY, partialTicks);
long start = System.nanoTime();
+ RenderManager.drawScaledString("HELLO", 10, 10, -1, false, 1.5f);
int x2 = 0;
int y2 = 0;
RenderManager.setupAndDraw((vg) -> {
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java
index a9ef863..98b2377 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java
@@ -1,7 +1,6 @@
package cc.polyfrost.oneconfig.gui.animations;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
-import cc.polyfrost.oneconfig.utils.color.ColorUtils;
public class ColorAnimation {
private ColorPalette palette;
@@ -25,6 +24,13 @@ public class ColorAnimation {
alphaAnimation = new DummyAnimation(palette.getNormalColorf()[3]);
}
+ /**
+ * Return the current color at the current time, according to a EaseInOut quadratic animation.
+ *
+ * @param hovered the hover state of the element
+ * @param pressed the pressed state of the element
+ * @return the current color
+ */
public int getColor(boolean hovered, boolean pressed) {
int state = pressed ? 2 : hovered ? 1 : 0;
if (state != prevState) {
@@ -38,6 +44,13 @@ public class ColorAnimation {
return ((int) (alphaAnimation.get() * 255) << 24) | ((int) (redAnimation.get() * 255) << 16) | ((int) (greenAnimation.get() * 255) << 8) | ((int) (blueAnimation.get() * 255));
}
+ /**
+ * Return the current alpha of the color. This method is used to get the alpha of pressed buttons that have text/icons on them, so they also darken accordingly.
+ */
+ public float getAlpha() {
+ return alphaAnimation.get(0);
+ }
+
public ColorPalette getPalette() {
return palette;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java
index bc97aca..dc5bc26 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java
@@ -1,6 +1,6 @@
package cc.polyfrost.oneconfig.gui.animations;
-public class DummyAnimation extends Animation{
+public class DummyAnimation extends Animation {
/**
* @param value The value that is returned
*/
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuad.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuad.java
index 9af6557..7b4ba7f 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuad.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuad.java
@@ -1,6 +1,6 @@
package cc.polyfrost.oneconfig.gui.animations;
-public class EaseInOutQuad extends Animation{
+public class EaseInOutQuad extends Animation {
/**
* @param duration The duration of the animation
@@ -17,7 +17,8 @@ public class EaseInOutQuad extends Animation{
*/
@Override
protected float animate(float timePassed, float duration, float start, float change) {
- if ((timePassed /= duration / 2) < 1) return change / 2 * timePassed * timePassed + start;;
+ if ((timePassed /= duration / 2) < 1) return change / 2 * timePassed * timePassed + start;
+ ;
return -change / 2 * ((--timePassed) * (timePassed - 2) - 1) + start;
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuart.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuart.java
index a21aa73..9c3abe9 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuart.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuart.java
@@ -1,6 +1,6 @@
package cc.polyfrost.oneconfig.gui.animations;
-public class EaseInOutQuart extends Animation{
+public class EaseInOutQuart extends Animation {
/**
* @param duration The duration of the animation
@@ -17,7 +17,8 @@ public class EaseInOutQuart extends Animation{
*/
@Override
protected float animate(float timePassed, float duration, float start, float change) {
- if ((timePassed /= duration / 2) < 1) return change / 2 * timePassed * timePassed * timePassed * timePassed + start;
+ if ((timePassed /= duration / 2) < 1)
+ return change / 2 * timePassed * timePassed * timePassed * timePassed + start;
return -change / 2 * ((timePassed -= 2) * timePassed * timePassed * timePassed - 2) + start;
}
}
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 6d9f88c..a55d931 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
@@ -1,12 +1,12 @@
package cc.polyfrost.oneconfig.gui.elements;
-import cc.polyfrost.oneconfig.config.OneConfigConfig;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.gui.pages.Page;
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.color.ColorPalette;
+import cc.polyfrost.oneconfig.utils.color.ColorUtils;
import org.jetbrains.annotations.NotNull;
public class BasicButton extends BasicElement {
@@ -15,6 +15,7 @@ public class BasicButton extends BasicElement {
protected SVGs icon1, icon2;
private final int alignment;
private final float fontSize, cornerRadius;
+ private float alpha;
private final int xSpacing, xPadding;
private final int iconSize;
public int x, y;
@@ -26,8 +27,6 @@ public class BasicButton extends BasicElement {
public static final int SIZE_36 = 36;
public static final int SIZE_40 = 40;
public static final int SIZE_48 = 48;
-
- public static final int CUSTOM_COLOR = -100;
private boolean toggleable = false;
private Page page;
private Runnable runnable;
@@ -65,11 +64,12 @@ public class BasicButton extends BasicElement {
if (disabled) RenderManager.setAlpha(vg, 0.5f);
float contentWidth = 0f;
int color = -1;
- if (colorPalette == ColorPalette.TERTIARY || colorPalette == ColorPalette.TERTIARY_DESTRUCTIVE)
+ if (colorPalette == ColorPalette.TERTIARY || colorPalette == ColorPalette.TERTIARY_DESTRUCTIVE) {
color = currentColor;
- else
+ } else {
RenderManager.drawRoundedRect(vg, x, y, this.width, this.height, currentColor, this.cornerRadius);
-
+ color = ColorUtils.getColor(1f, 1f, 1f, alpha);
+ }
final float middle = x + width / 2f;
final float middleYIcon = y + height / 2f - iconSize / 2f;
final float middleYText = y + height / 2f + fontSize / 8f;
@@ -106,7 +106,6 @@ public class BasicButton extends BasicElement {
}
if (text != null) {
RenderManager.drawText(vg, text, x + contentWidth, middleYText, color, fontSize, Fonts.MEDIUM);
- contentWidth += RenderManager.getTextWidth(vg, text, fontSize, Fonts.MEDIUM) + xSpacing;
}
if (icon2 != null)
RenderManager.drawSvg(vg, icon2, x + width - xPadding - iconSize, middleYIcon, iconSize, iconSize, color);
@@ -114,6 +113,11 @@ public class BasicButton extends BasicElement {
if (disabled) RenderManager.setAlpha(vg, 1f);
}
+ @Override
+ public void update(int x, int y) {
+ super.update(x, y);
+ this.alpha = colorAnimation.getAlpha();
+ }
@Override
public void onClick() {
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 0e3fe23..f0b930c 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
@@ -9,17 +9,47 @@ import org.lwjgl.input.Mouse;
public class BasicElement {
protected int width, height;
+ /**
+ * The color palette used for this element.
+ */
protected ColorPalette colorPalette;
+ /**
+ * hitBoxX and hitBoxY are integer variables to determine (in pixels) how far past the boundaries of this button it is still able to be interacted with.
+ */
protected int hitBoxX, hitBoxY;
protected boolean hoverFx;
+ /**
+ * Whether the element is currently being hovered over
+ */
protected boolean hovered = false;
+ /**
+ * Whether the mouse is actively being held down on the element.
+ */
protected boolean pressed = false;
+ /**
+ * Whether the element is clicked.
+ */
protected boolean clicked = false;
+ /**
+ * The toggle state of the button. Its false, then if it is clicked, it becomes true, and if clicked again, it becomes false.
+ */
protected boolean toggled = false;
+ /**
+ * Whether the element is currently disabled.
+ */
protected boolean disabled = false;
+ /**
+ * The ARGB color of this element.
+ */
public int currentColor;
protected final float radius;
+ /**
+ * Boolean to determine if this element is allowed to be clicked when {@link InputUtils#isBlockingClicks()} is true.
+ */
private boolean block = false;
+ /**
+ * The color animation used by this element.
+ */
protected ColorAnimation colorAnimation;
public BasicElement(int width, int height, @NotNull ColorPalette colorPalette, boolean hoverFx) {
@@ -40,11 +70,22 @@ public class BasicElement {
}
+ /**
+ * Draw script for the element.
+ *
- * Not to be confused with Minecraft deltaTicks / renderPartialTicks, which can be gotten via
- * {@link cc.polyfrost.oneconfig.events.event.TimerUpdateEvent}
+ * Not to be confused with Minecraft deltaTicks / renderPartialTicks, which can be gotten via
+ * {@link cc.polyfrost.oneconfig.events.event.TimerUpdateEvent}
*
Make sure to call {@link #update(int x, int y)} to update the elements states!
+ *
+ * @param vg NanoVG context (see {@link RenderManager})
+ * @param x x position of the element
+ * @param y y position of the element
+ */
public void draw(long vg, int x, int y) {
this.update(x, y);
RenderManager.drawRoundedRect(vg, x, y, width, height, currentColor, radius);
}
+ /**
+ * Update this element's clicked, hovered, toggled, and pressed states, invoke any necessary methods, and update the color animation.
+ */
public void update(int x, int y) {
if (disabled) {
hovered = false;
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 1a53564..e16b83e 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java
@@ -3,7 +3,10 @@ package cc.polyfrost.oneconfig.gui.elements;
import cc.polyfrost.oneconfig.config.OneConfigConfig;
import cc.polyfrost.oneconfig.config.core.OneColor;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
-import cc.polyfrost.oneconfig.gui.animations.*;
+import cc.polyfrost.oneconfig.gui.animations.Animation;
+import cc.polyfrost.oneconfig.gui.animations.DummyAnimation;
+import cc.polyfrost.oneconfig.gui.animations.EaseInOutCubic;
+import cc.polyfrost.oneconfig.gui.animations.EaseInOutQuad;
import cc.polyfrost.oneconfig.gui.elements.text.NumberInputField;
import cc.polyfrost.oneconfig.gui.elements.text.TextInputField;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
index e8d4b2d..b7fbe9a 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
@@ -10,8 +10,8 @@ import cc.polyfrost.oneconfig.libs.universal.wrappers.UPlayer;
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.color.ColorPalette;
import cc.polyfrost.oneconfig.utils.InputUtils;
+import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.fml.common.ModMetadata;
import org.jetbrains.annotations.NotNull;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java
index 16b1ea2..121416d 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java
@@ -29,7 +29,7 @@ public class ConfigColorElement extends BasicOption {
@Override
public void draw(long vg, int x, int y) {
- if(!isEnabled()) RenderManager.setAlpha(vg, 0.5f);
+ if (!isEnabled()) RenderManager.setAlpha(vg, 0.5f);
hexField.disable(!isEnabled());
alphaField.disable(!isEnabled());
element.disable(!isEnabled());
@@ -81,7 +81,7 @@ public class ConfigColorElement extends BasicOption {
open = !open;
OneConfigGui.INSTANCE.initColorSelector(new ColorSelector(color, InputUtils.mouseX(), InputUtils.mouseY()));
}
- if(OneConfigGui.INSTANCE.currentColorSelector == null) open = false;
+ if (OneConfigGui.INSTANCE.currentColorSelector == null) open = false;
if (OneConfigGui.INSTANCE.currentColorSelector != null && open) {
color = (OneConfigGui.INSTANCE.getColor());
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
index 156f782..472f80e 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
@@ -6,9 +6,8 @@ import cc.polyfrost.oneconfig.gui.animations.ColorAnimation;
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.color.ColorPalette;
-import cc.polyfrost.oneconfig.utils.color.ColorUtils;
import cc.polyfrost.oneconfig.utils.InputUtils;
+import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import org.lwjgl.input.Mouse;
import java.awt.*;
@@ -18,7 +17,7 @@ import java.util.Arrays;
public class ConfigDropdown extends BasicOption {
private final String[] options;
private final ColorAnimation backgroundColor = new ColorAnimation(ColorPalette.SECONDARY);
- private final ColorAnimation atomColor = new ColorAnimation(new ColorPalette(OneConfigConfig.PRIMARY_600, OneConfigConfig.PRIMARY_500, OneConfigConfig.PRIMARY_500));
+ private final ColorAnimation atomColor = new ColorAnimation(new ColorPalette(OneConfigConfig.PRIMARY_600, OneConfigConfig.PRIMARY_500, OneConfigConfig.PRIMARY_500));
private boolean opened = false;
public ConfigDropdown(Field field, Object parent, String name, int size, String[] options) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java
index 7a458c8..700d3dd 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java
@@ -2,11 +2,12 @@ package cc.polyfrost.oneconfig.gui.elements.config;
import cc.polyfrost.oneconfig.config.OneConfigConfig;
import cc.polyfrost.oneconfig.config.interfaces.BasicOption;
-import cc.polyfrost.oneconfig.gui.animations.*;
+import cc.polyfrost.oneconfig.gui.animations.Animation;
+import cc.polyfrost.oneconfig.gui.animations.DummyAnimation;
+import cc.polyfrost.oneconfig.gui.animations.EaseInOutCubic;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.utils.InputUtils;
-import cc.polyfrost.oneconfig.utils.MathUtils;
import java.lang.reflect.Field;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java
index b464423..24a512c 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java
@@ -9,8 +9,8 @@ import cc.polyfrost.oneconfig.gui.pages.ModConfigPage;
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.color.ColorPalette;
import cc.polyfrost.oneconfig.utils.InputUtils;
+import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import org.lwjgl.input.Mouse;
import java.lang.reflect.Field;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java
index cb54f9b..090f5a6 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java
@@ -8,10 +8,8 @@ import cc.polyfrost.oneconfig.gui.animations.DummyAnimation;
import cc.polyfrost.oneconfig.gui.animations.EaseInOutQuad;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
-import cc.polyfrost.oneconfig.utils.color.ColorPalette;
-import cc.polyfrost.oneconfig.utils.color.ColorUtils;
import cc.polyfrost.oneconfig.utils.InputUtils;
-import cc.polyfrost.oneconfig.utils.MathUtils;
+import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import org.lwjgl.input.Mouse;
import java.lang.reflect.Field;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java
index 69b1584..c3edb62 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java
@@ -6,7 +6,6 @@ import cc.polyfrost.oneconfig.gui.elements.BasicElement;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
-import cc.polyfrost.oneconfig.utils.color.ColorUtils;
public class NumberInputField extends TextInputField {
private final BasicElement upArrow = new BasicElement(12, 14, false);
@@ -15,7 +14,7 @@ public class NumberInputField extends TextInputField {
private float max;
private float step;
private final ColorAnimation colorTop = new ColorAnimation(ColorPalette.SECONDARY);
- private final ColorAnimation colorBottom = new ColorAnimation(ColorPalette.SECONDARY);
+ private final ColorAnimation colorBottom = new ColorAnimation(ColorPalette.SECONDARY);
private float current;
public NumberInputField(int width, int height, float defaultValue, float min, float max, float step) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java
index 2866008..3b8e172 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java
@@ -67,9 +67,9 @@ public class ModsPage extends Page {
for (BasicButton btn : modCategories) {
btn.draw(vg, iXCat, y + 16);
iXCat += btn.getWidth() + 8;
- if(btn.isToggled()) selected = true;
+ if (btn.isToggled()) selected = true;
}
- if(!selected) modCategories.get(0).setToggled(true);
+ if (!selected) modCategories.get(0).setToggled(true);
return 60;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java
index 4e85cf5..9c10841 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java
@@ -1,11 +1,9 @@
package cc.polyfrost.oneconfig.gui.pages;
import cc.polyfrost.oneconfig.gui.animations.Animation;
-import cc.polyfrost.oneconfig.gui.animations.EaseInOutQuad;
import cc.polyfrost.oneconfig.gui.animations.EaseOutQuad;
import cc.polyfrost.oneconfig.lwjgl.scissor.Scissor;
import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager;
-import cc.polyfrost.oneconfig.utils.MathUtils;
import org.lwjgl.input.Mouse;
/**
diff --git a/src/main/java/cc/polyfrost/oneconfig/init/OneConfigInit.java b/src/main/java/cc/polyfrost/oneconfig/init/OneConfigInit.java
index 6e0bab3..df424fd 100644
--- a/src/main/java/cc/polyfrost/oneconfig/init/OneConfigInit.java
+++ b/src/main/java/cc/polyfrost/oneconfig/init/OneConfigInit.java
@@ -13,6 +13,7 @@ public class OneConfigInit {
/**
* Initializes the OneConfig mod.
+ *
* @param args The arguments passed to the mod.
*/
public static void initialize(String[] args) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
index 289ab03..faf3e13 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
@@ -24,13 +24,15 @@ public final class ImageLoader {
private ImageLoader() {
}
+
private final HashMap
* To register commands, either extend {@link CommandHelper} and run {@link CommandHelper#preload()} (which does nothing,
* just makes loading look nicer lol), or use {@link CommandManager#registerCommand(Object)}.
*
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Main.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Main.java
index 3c105c7..9b49fb4 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Main.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Main.java
@@ -16,5 +16,6 @@ import java.lang.annotation.Target;
@Target({ElementType.METHOD})
public @interface Main {
String description() default "";
+
int priority() default 1000;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Name.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Name.java
index ef178a0..f802697 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Name.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Name.java
@@ -16,6 +16,7 @@ import java.lang.annotation.Target;
public @interface Name {
/**
* The name of the parameter.
+ *
* @return The name of the parameter.
*/
String value();
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/SubCommand.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/SubCommand.java
index b1cf035..1bfbd53 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/SubCommand.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/SubCommand.java
@@ -16,18 +16,21 @@ import java.lang.annotation.Target;
public @interface SubCommand {
/**
* The name of the command.
+ *
* @return The name of the command.
*/
String value();
/**
* The aliases of the command.
+ *
* @return The aliases of the command.
*/
String[] aliases() default {};
/**
* The description of the command.
+ *
* @return The description of the command.
*/
String description() default "";
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/ArgumentParser.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/ArgumentParser.java
index d9d51b0..61d1e07 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/ArgumentParser.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/ArgumentParser.java
@@ -5,8 +5,10 @@ import org.jetbrains.annotations.Nullable;
@SuppressWarnings("unstable")
public abstract class ArgumentParser