aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/events/event/ReceivePacketEvent.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/events/event/SendPacketEvent.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java8
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java15
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuad.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuart.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java18
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java41
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/init/OneConfigInit.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java17
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java13
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/mixin/FontRendererMixin.java15
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage.java35
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/GuiUtils.java9
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java15
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/JsonUtils.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/Multithreading.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/NetworkUtils.java20
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/TextUtils.java14
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/color/ColorUtils.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandManager.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Command.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Main.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Name.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/SubCommand.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/ArgumentParser.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/hypixel/HypixelUtils.java3
-rw-r--r--src/main/resources/mixins.oneconfig.json1
41 files changed, 209 insertions, 90 deletions
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.
+ * <br> <b>Make sure to call {@link #update(int x, int y)} to update the elements states!</b>
+ *
+ * @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<String, Integer> imageHashMap = new HashMap<>();
private final HashMap<String, Integer> svgHashMap = new HashMap<>();
public static ImageLoader INSTANCE = new ImageLoader();
/**
* Loads an image from resources.
- * @param vg The NanoVG context.
+ *
+ * @param vg The NanoVG context.
* @param fileName The name of the file to load.
* @return Whether the image was loaded successfully.
*/
@@ -58,10 +60,11 @@ public final class ImageLoader {
/**
* Loads an SVG from resources.
- * @param vg The NanoVG context.
+ *
+ * @param vg The NanoVG context.
* @param fileName The name of the file to load.
- * @param width The width of the SVG.
- * @param height The height of the SVG.
+ * @param width The width of the SVG.
+ * @param height The height of the SVG.
* @return Whether the SVG was loaded successfully.
*/
public boolean loadSVG(long vg, String fileName, float width, float height) {
@@ -121,9 +124,8 @@ public final class ImageLoader {
* Remove an image from the cache, allowing the image to be garbage collected.
* Should be used when the GUI rendering the image is closed.
*
- * @param vg The NanoVG context.
+ * @param vg The NanoVG context.
* @param fileName The name of the file to remove.
- *
* @see ImageLoader#loadImage(long, String)
*/
public void removeImage(long vg, String fileName) {
@@ -162,9 +164,8 @@ public final class ImageLoader {
* Remove a SVG from the cache, allowing the SVG to be garbage collected.
* Should be used when the GUI rendering the SVG is closed.
*
- * @param vg The NanoVG context.
+ * @param vg The NanoVG context.
* @param fileName The name of the file to remove.
- *
* @see ImageLoader#loadSVG(long, String, float, float)
*/
public void removeSVG(long vg, String fileName, float width, float height) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java
index 05747df..159de96 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java
@@ -12,10 +12,11 @@ public class ScissorManager {
/**
* Adds and applies a scissor rectangle to the list of scissor rectangles.
- * @param vg The NanoVG context.
- * @param x The x coordinate of the scissor rectangle.
- * @param y The y coordinate of the scissor rectangle.
- * @param width The width of the scissor rectangle.
+ *
+ * @param vg The NanoVG context.
+ * @param x The x coordinate of the scissor rectangle.
+ * @param y The y coordinate of the scissor rectangle.
+ * @param width The width of the scissor rectangle.
* @param height The height of the scissor rectangle.
* @return The scissor rectangle.
*/
@@ -29,7 +30,8 @@ public class ScissorManager {
/**
* Resets the scissor rectangle provided.
- * @param vg The NanoVG context.
+ *
+ * @param vg The NanoVG context.
* @param scissor The scissor rectangle to reset.
*/
public static void resetScissor(long vg, Scissor scissor) {
@@ -41,6 +43,7 @@ public class ScissorManager {
/**
* Clear all scissor rectangles.
+ *
* @param vg The NanoVG context.
*/
public static void clearScissors(long vg) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/mixin/FontRendererMixin.java b/src/main/java/cc/polyfrost/oneconfig/mixin/FontRendererMixin.java
new file mode 100644
index 0000000..7eac19d
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/mixin/FontRendererMixin.java
@@ -0,0 +1,15 @@
+package cc.polyfrost.oneconfig.mixin;
+
+
+import net.minecraft.client.gui.FontRenderer;
+import org.spongepowered.asm.mixin.Mixin;
+
+@Mixin(FontRenderer.class)
+public class FontRendererMixin {
+
+ //@Inject(method = "renderDefaultChar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;bindTexture(Lnet/minecraft/util/ResourceLocation;)V", shift = At.Shift.AFTER))
+ //public void whoAsked(int ch, boolean italic, CallbackInfoReturnable<Float> cir) {
+ // GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
+ // GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
+ //}
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java b/src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java
index 5d11729..e40c5fc 100644
--- a/src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java
+++ b/src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java
@@ -16,7 +16,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Minecraft.class)
public class MinecraftMixin {
- @Shadow private Timer timer;
+ @Shadow
+ private Timer timer;
@Inject(method = "startGame", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/FMLClientHandler;beginMinecraftLoading(Lnet/minecraft/client/Minecraft;Ljava/util/List;Lnet/minecraft/client/resources/IReloadableResourceManager;)V", remap = false), remap = true)
private void onPreLaunch(CallbackInfo ci) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage.java b/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage.java
index 5e2a864..fb137db 100644
--- a/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage.java
+++ b/src/main/java/cc/polyfrost/oneconfig/test/ButtonTestPage.java
@@ -9,29 +9,44 @@ import java.util.ArrayList;
public class ButtonTestPage extends Page {
private final ArrayList<BasicButton> row1 = new ArrayList<BasicButton>() {{
- add(new BasicButton(254, 48, "Primary", BasicButton.ALIGNMENT_CENTER, ColorPalette.PRIMARY));
- add(new BasicButton(254, 48, "Primary Destructive", BasicButton.ALIGNMENT_CENTER, ColorPalette.PRIMARY_DESTRUCTIVE));
- add(new BasicButton(254, 48, "Secondary", BasicButton.ALIGNMENT_CENTER, ColorPalette.SECONDARY));
- add(new BasicButton(254, 48, "Secondary Destructive", BasicButton.ALIGNMENT_CENTER, ColorPalette.SECONDARY_DESTRUCTIVE));
- add(new BasicButton(254, 48, "Tertiary", BasicButton.ALIGNMENT_CENTER, ColorPalette.TERTIARY));
- add(new BasicButton(254, 48, "Tertiary Destructive", BasicButton.ALIGNMENT_CENTER, ColorPalette.TERTIARY_DESTRUCTIVE));
+ add(new BasicButton(254, 48, "Primary", BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY));
+ add(new BasicButton(254, 48, "Primary Destructive", BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY_DESTRUCTIVE));
+ add(new BasicButton(254, 48, "Secondary", BasicButton.ALIGNMENT_LEFT, ColorPalette.SECONDARY));
+ add(new BasicButton(254, 48, "Secondary Destructive", BasicButton.ALIGNMENT_LEFT, ColorPalette.SECONDARY_DESTRUCTIVE));
+ add(new BasicButton(254, 48, "Tertiary", BasicButton.ALIGNMENT_LEFT, ColorPalette.TERTIARY));
+ add(new BasicButton(254, 48, "Tertiary Destructive", BasicButton.ALIGNMENT_LEFT, ColorPalette.TERTIARY_DESTRUCTIVE));
+ add(new BasicButton(254, 48, "LeftIconLA", SVGs.BOX, null, BasicButton.ALIGNMENT_LEFT, ColorPalette.SECONDARY));
+ add(new BasicButton(254, 48, "RightIconLA", null, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.SECONDARY));
+ add(new BasicButton(254, 48, "LeftIconCA", SVGs.BOX, null, BasicButton.ALIGNMENT_CENTER, ColorPalette.SECONDARY));
+ add(new BasicButton(254, 48, "RightIconCA", null, SVGs.BOX, BasicButton.ALIGNMENT_CENTER, ColorPalette.SECONDARY));
}};
private final ArrayList<BasicButton> row2 = new ArrayList<BasicButton>() {{
- add(new BasicButton(170, 32, "32", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_CENTER, ColorPalette.PRIMARY));
- add(new BasicButton(193, 36, "36", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_CENTER, ColorPalette.PRIMARY));
- add(new BasicButton(208, 40, "40", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_CENTER, ColorPalette.PRIMARY));
- add(new BasicButton(254, 48, "48", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_CENTER, ColorPalette.PRIMARY));
+ add(new BasicButton(170, 32, "32", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY));
+ add(new BasicButton(193, 36, "36", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY));
+ add(new BasicButton(208, 40, "40", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY));
+ add(new BasicButton(254, 48, "48", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY));
+ add(new BasicButton(254, 48, "JustifiedRight", null, SVGs.BOX, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.SECONDARY_DESTRUCTIVE));
+ add(new BasicButton(254, 48, "JustifiedLeft", SVGs.BOX, null, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.SECONDARY_DESTRUCTIVE));
+ add(new BasicButton(254, 48, "JustifiedNoIcon", null, null, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.PRIMARY));
+ add(new BasicButton(254, 48, "TertiaryIcon", SVGs.BOX, null, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.TERTIARY_DESTRUCTIVE));
+
}};
private final ArrayList<BasicButton> row3 = new ArrayList<BasicButton>() {{
add(new BasicButton(254, 48, "Left", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY));
add(new BasicButton(254, 48, "Center", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_CENTER, ColorPalette.PRIMARY));
add(new BasicButton(254, 48, "Justified", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.PRIMARY));
+ add(new BasicButton(254, 48, "Disabled :(", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_LEFT, ColorPalette.PRIMARY));
+ add(new BasicButton(254, 48, "Disabled :(", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_CENTER, ColorPalette.PRIMARY));
+ add(new BasicButton(254, 48, "Disabled :(", SVGs.BOX, SVGs.BOX, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.PRIMARY));
}};
public ButtonTestPage() {
super("Buttons");
+ row3.get(3).disable(true);
+ row3.get(4).disable(true);
+ row3.get(5).disable(true);
}
@Override
diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java
index 6ce55f4..e67d491 100644
--- a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java
@@ -7,7 +7,6 @@ import cc.polyfrost.oneconfig.config.core.OneKeyBind;
import cc.polyfrost.oneconfig.config.data.*;
import cc.polyfrost.oneconfig.config.interfaces.Config;
import cc.polyfrost.oneconfig.config.migration.VigilanceMigrator;
-import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
import net.minecraftforge.fml.common.FMLCommonHandler;
public class TestConfig extends Config {
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/GuiUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/GuiUtils.java
index c6afb00..fa2a6ea 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/GuiUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/GuiUtils.java
@@ -15,6 +15,7 @@ public final class GuiUtils {
static {
EventManager.INSTANCE.register(new GuiUtils());
}
+
private static long time = -1L;
private static long deltaTime = 17L;
@@ -27,7 +28,9 @@ public final class GuiUtils {
new TickDelay(() -> UScreen.displayScreen(screen), 1);
}
- /** Close the current open GUI screen. */
+ /**
+ * Close the current open GUI screen.
+ */
public static void closeScreen() {
UScreen.displayScreen(null);
}
@@ -35,8 +38,8 @@ public final class GuiUtils {
/**
* Gets the delta time (in milliseconds) between frames.
* <p><b>
- * 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}
* </b></p>
*
* @return the delta time.
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java
index 0ba4c00..0f50a33 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java
@@ -28,10 +28,10 @@ public final class InputUtils {
/**
* Checks whether the mouse is currently over a specific region and clicked.
*
- * @param x the x position of the region
- * @param y the y position of the region
- * @param width the width of the region
- * @param height the height of the region
+ * @param x the x position of the region
+ * @param y the y position of the region
+ * @param width the width of the region
+ * @param height the height of the region
* @param ignoreBlock if true, will ignore {@link InputUtils#blockClicks(boolean)}
* @return true if the mouse is clicked and is over the region, false if not
* @see InputUtils#isAreaHovered(int, int, int, int)
@@ -43,9 +43,9 @@ public final class InputUtils {
/**
* Checks whether the mouse is currently over a specific region and clicked.
*
- * @param x the x position of the region
- * @param y the y position of the region
- * @param width the width of the region
+ * @param x the x position of the region
+ * @param y the y position of the region
+ * @param width the width of the region
* @param height the height of the region
* @return true if the mouse is clicked and is over the region, false if not
* @see InputUtils#isAreaClicked(int, int, int, int, boolean)
@@ -111,6 +111,7 @@ public final class InputUtils {
/**
* Whether clicks are blocked
+ *
* @return true if clicks are blocked, false if not
*/
public static boolean isBlockingClicks() {
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/JsonUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/JsonUtils.java
index 67881e9..320b630 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/JsonUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/JsonUtils.java
@@ -16,7 +16,7 @@ public final class JsonUtils {
/**
* Parses a string into a {@link JsonElement}.
*
- * @param string The string to parse.
+ * @param string The string to parse.
* @param catchExceptions Whether to catch exceptions.
* @return The {@link JsonElement}.
* @see JsonParser#parse(String)
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/Multithreading.java b/src/main/java/cc/polyfrost/oneconfig/utils/Multithreading.java
index 518d699..745ded8 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/Multithreading.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/Multithreading.java
@@ -52,7 +52,7 @@ public class Multithreading {
* Schedules the runnable to run asynchronously after the specified delay.
*
* @param runnable The runnable to run.
- * @param delay The delay before the runnable is run.
+ * @param delay The delay before the runnable is run.
* @param timeUnit The {@link TimeUnit} of the delay.
* @see Multithreading#submitScheduled(Runnable, long, TimeUnit)
*/
@@ -64,7 +64,7 @@ public class Multithreading {
* Submits the Runnable to the executor after a delay, making it run asynchronously.
*
* @param runnable The runnable to run.
- * @param delay The delay before the runnable is run.
+ * @param delay The delay before the runnable is run.
* @param timeUnit The {@link TimeUnit} of the delay.
* @return The future representing the submitted runnable.
* @see ScheduledExecutorService#schedule(Runnable, long, TimeUnit)
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/NetworkUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/NetworkUtils.java
index 767f36f..aea7812 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/NetworkUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/NetworkUtils.java
@@ -18,9 +18,10 @@ public final class NetworkUtils {
/**
* Gets the contents of a URL as a String.
- * @param url The URL to read.
+ *
+ * @param url The URL to read.
* @param userAgent The user agent to use.
- * @param timeout The timeout in milliseconds.
+ * @param timeout The timeout in milliseconds.
* @param useCaches Whether to use caches.
* @return The contents of the URL.
*/
@@ -47,9 +48,9 @@ public final class NetworkUtils {
/**
* Gets the contents of a URL as a JsonElement.
*
- * @param url The URL to read.
+ * @param url The URL to read.
* @param userAgent The user agent to use.
- * @param timeout The timeout in milliseconds.
+ * @param timeout The timeout in milliseconds.
* @param useCaches Whether to use caches.
* @return The contents of the URL.
* @see NetworkUtils#getString(String, String, int, boolean)
@@ -72,10 +73,11 @@ public final class NetworkUtils {
/**
* Downloads a file from a URL.
- * @param url The URL to download from.
- * @param file The file to download to.
+ *
+ * @param url The URL to download from.
+ * @param file The file to download to.
* @param userAgent The user agent to use.
- * @param timeout The timeout in milliseconds.
+ * @param timeout The timeout in milliseconds.
* @param useCaches Whether to use caches.
* @return Whether the download was successful.
*/
@@ -92,7 +94,8 @@ public final class NetworkUtils {
/**
* Downloads a file from a URL.
- * @param url The URL to download from.
+ *
+ * @param url The URL to download from.
* @param file The file to download to.
* @return Whether the download was successful.
* @see NetworkUtils#downloadFile(String, File, String, int, boolean)
@@ -103,6 +106,7 @@ public final class NetworkUtils {
/**
* Gets the SHA-256 hash of a file.
+ *
* @param file The file to hash.
* @return The SHA-256 hash of the file.
*/
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/TextUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/TextUtils.java
index 4fa5125..df37aae 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/TextUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/TextUtils.java
@@ -13,11 +13,12 @@ public final class TextUtils {
/**
* Wraps a string into an array of lines.
- * @param vg The NanoVG context.
- * @param text The text to wrap.
+ *
+ * @param vg The NanoVG context.
+ * @param text The text to wrap.
* @param maxWidth The maximum width of each line.
* @param fontSize The font size.
- * @param font The font to use.
+ * @param font The font to use.
* @return The array of lines.
*/
public static ArrayList<String> wrapText(long vg, String text, float maxWidth, float fontSize, Fonts font) {
@@ -26,11 +27,12 @@ public final class TextUtils {
/**
* Wraps a string into an array of lines.
- * @param vg The NanoVG context.
- * @param text The text to wrap.
+ *
+ * @param vg The NanoVG context.
+ * @param text The text to wrap.
* @param maxWidth The maximum width of each line.
* @param fontSize The font size.
- * @param font The font to use.
+ * @param font The font to use.
* @return The array of lines.
*/
public static ArrayList<String> wrapText(long vg, String text, float maxWidth, float fontSize, Font font) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/color/ColorUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/color/ColorUtils.java
index ebf0100..efadc51 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/color/ColorUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/color/ColorUtils.java
@@ -54,7 +54,7 @@ public final class ColorUtils {
* @return the RGB color.
*/
public static int getColor(float red, float green, float blue, float alpha) {
- return getColor((int) red * 255, (int) green * 255, (int) blue * 255, (int) alpha * 255);
+ return getColor((int) (red * 255f), (int) (green * 255f), (int) (blue * 255f), (int) (alpha * 255f));
}
/**
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandManager.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandManager.java
index 913ee73..4a008d3 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandManager.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandManager.java
@@ -6,7 +6,6 @@ import cc.polyfrost.oneconfig.utils.commands.annotations.*;
import cc.polyfrost.oneconfig.utils.commands.arguments.*;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
-import net.minecraft.util.BlockPos;
import net.minecraftforge.client.ClientCommandHandler;
import java.lang.reflect.InvocationTargetException;
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Command.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Command.java
index b1a4ce5..89b5227 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Command.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Command.java
@@ -72,7 +72,7 @@ import java.lang.annotation.Target;
* }
* }</pre>
* </p>
- *
+ * <p>
* 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<T> {
- private final TypeToken<T> type = new TypeToken<T>(getClass()) {};
+ private final TypeToken<T> type = new TypeToken<T>(getClass()) {
+ };
public final Class<?> typeClass = type.getRawType();
+
@Nullable
public abstract T parse(Arguments arguments);
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/hypixel/HypixelUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/hypixel/HypixelUtils.java
index d7a9b0d..c890939 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/hypixel/HypixelUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/hypixel/HypixelUtils.java
@@ -133,6 +133,7 @@ public class HypixelUtils {
/**
* Returns whether the player is in game.
+ *
* @return Whether the player is in game.
*/
public boolean isInGame() {
@@ -141,6 +142,7 @@ public class HypixelUtils {
/**
* Returns the current {@link LocrawInfo}.
+ *
* @return The current {@link LocrawInfo}.
* @see LocrawInfo
*/
@@ -150,6 +152,7 @@ public class HypixelUtils {
/**
* Returns the previous {@link LocrawInfo}.
+ *
* @return The previous {@link LocrawInfo}.
* @see LocrawInfo
*/
diff --git a/src/main/resources/mixins.oneconfig.json b/src/main/resources/mixins.oneconfig.json
index fa23932..63a1e08 100644
--- a/src/main/resources/mixins.oneconfig.json
+++ b/src/main/resources/mixins.oneconfig.json
@@ -9,6 +9,7 @@
},
"verbose": true,
"client": [
+ "FontRendererMixin",
"GuiIngameForgeMixin",
"MinecraftMixin",
"NetHandlerPlayClientMixin",