diff options
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/utils')
3 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java index 19d399f..79634da 100644 --- a/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java +++ b/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java @@ -4,7 +4,7 @@ import cc.polyfrost.oneconfig.gui.OneConfigGui; public final class MathUtils { public static float clamp(float number) { - return number < 0f ? 0f : Math.min(number, 1f); + return clamp(number, 0, 1); } public static float clamp(float number, float min, float max) { diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/TextUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/TextUtils.java index f9f0fbd..4fa5125 100644 --- a/src/main/java/cc/polyfrost/oneconfig/utils/TextUtils.java +++ b/src/main/java/cc/polyfrost/oneconfig/utils/TextUtils.java @@ -1,6 +1,7 @@ package cc.polyfrost.oneconfig.utils; import cc.polyfrost.oneconfig.lwjgl.RenderManager; +import cc.polyfrost.oneconfig.lwjgl.font.Font; import cc.polyfrost.oneconfig.lwjgl.font.Fonts; import java.util.ArrayList; @@ -20,6 +21,19 @@ public final class TextUtils { * @return The array of lines. */ public static ArrayList<String> wrapText(long vg, String text, float maxWidth, float fontSize, Fonts font) { + return wrapText(vg, text, maxWidth, fontSize, font.font); + } + + /** + * Wraps a string into an array of lines. + * @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. + * @return The array of lines. + */ + public static ArrayList<String> wrapText(long vg, String text, float maxWidth, float fontSize, Font font) { ArrayList<String> wrappedText = new ArrayList<>(); text += " "; int prevIndex = 0; diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandHelper.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandHelper.java index bc57fc2..3e7b7ea 100644 --- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandHelper.java +++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandHelper.java @@ -10,7 +10,7 @@ package cc.polyfrost.oneconfig.utils.commands; public abstract class CommandHelper { public CommandHelper() { - CommandManager.registerCommand(this); + CommandManager.INSTANCE.registerCommand(this); } public void preload() { |