aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/core
diff options
context:
space:
mode:
authorTymanWasTaken <tyman@tyman.tech>2021-07-06 17:20:49 -0400
committerTymanWasTaken <tyman@tyman.tech>2021-07-06 17:20:49 -0400
commitc04ca523f9fb9f7adefa74587db61f76deeae9f0 (patch)
treef148e7bcd9105813d3fe781badcb2cf3892712fd /src/main/java/com/thatgravyboat/skyblockhud/core
parenta8e475fa0a7977f64f072548459d592274169d66 (diff)
downloadskyblockhud-c04ca523f9fb9f7adefa74587db61f76deeae9f0.tar.gz
skyblockhud-c04ca523f9fb9f7adefa74587db61f76deeae9f0.tar.bz2
skyblockhud-c04ca523f9fb9f7adefa74587db61f76deeae9f0.zip
Increase line width
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/core')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/BackgroundBlur.java88
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/ChromaColour.java40
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/GlScissorStack.java19
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementBoolean.java29
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementColour.java350
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementTextField.java302
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/GuiScreenElementWrapper.java7
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/config/Position.java22
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditor.java42
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorAccordion.java29
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorBoolean.java9
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorButton.java11
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorColour.java19
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDraggableList.java101
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDropdown.java72
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorSlider.java44
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorText.java26
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiPositionEditor.java113
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/config/struct/ConfigProcessor.java127
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/util/GuiElementSlider.java87
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/util/MiscUtils.java41
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/util/StringUtils.java5
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/util/lerp/LerpUtils.java6
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/util/lerp/LerpingFloat.java3
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/util/lerp/LerpingInteger.java3
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/util/render/RenderUtils.java193
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/core/util/render/TextRenderUtils.java69
27 files changed, 324 insertions, 1533 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/BackgroundBlur.java b/src/main/java/com/thatgravyboat/skyblockhud/core/BackgroundBlur.java
index e95e896..7c252ad 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/BackgroundBlur.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/BackgroundBlur.java
@@ -66,10 +66,8 @@ public class BackgroundBlur {
}
);
- output.framebufferWidth =
- output.framebufferTextureWidth = width;
- output.framebufferHeight =
- output.framebufferTextureHeight = height;
+ output.framebufferWidth = output.framebufferTextureWidth = width;
+ output.framebufferHeight = output.framebufferTextureHeight = height;
blurBackground(output, blur);
}
@@ -129,10 +127,7 @@ public class BackgroundBlur {
}
private static void blurBackground(Framebuffer output, float blurFactor) {
- if (
- !OpenGlHelper.isFramebufferEnabled() ||
- !OpenGlHelper.areShadersSupported()
- ) return;
+ if (!OpenGlHelper.isFramebufferEnabled() || !OpenGlHelper.areShadersSupported()) return;
int width = Minecraft.getMinecraft().displayWidth;
int height = Minecraft.getMinecraft().displayHeight;
@@ -151,14 +146,9 @@ public class BackgroundBlur {
if (blurOutputHorz == null || output == null) {
return;
}
- if (
- blurOutputHorz.framebufferWidth != width ||
- blurOutputHorz.framebufferHeight != height
- ) {
+ if (blurOutputHorz.framebufferWidth != width || blurOutputHorz.framebufferHeight != height) {
blurOutputHorz.createBindFramebuffer(width, height);
- blurShaderHorz.setProjectionMatrix(
- createProjectionMatrix(width, height)
- );
+ blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height));
Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
}
@@ -170,47 +160,22 @@ public class BackgroundBlur {
Minecraft.getMinecraft().getFramebuffer(),
blurOutputHorz
);
- blurShaderHorz
- .getShaderManager()
- .getShaderUniform("BlurDir")
- .set(1, 0);
- blurShaderHorz.setProjectionMatrix(
- createProjectionMatrix(width, height)
- );
+ blurShaderHorz.getShaderManager().getShaderUniform("BlurDir").set(1, 0);
+ blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height));
} catch (Exception ignored) {}
try {
- blurShaderVert =
- new Shader(
- Minecraft.getMinecraft().getResourceManager(),
- "blur",
- blurOutputHorz,
- output
- );
- blurShaderVert
- .getShaderManager()
- .getShaderUniform("BlurDir")
- .set(0, 1);
- blurShaderVert.setProjectionMatrix(
- createProjectionMatrix(width, height)
- );
+ blurShaderVert = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur", blurOutputHorz, output);
+ blurShaderVert.getShaderManager().getShaderUniform("BlurDir").set(0, 1);
+ blurShaderVert.setProjectionMatrix(createProjectionMatrix(width, height));
} catch (Exception ignored) {}
if (blurShaderHorz != null && blurShaderVert != null) {
- if (
- blurShaderHorz.getShaderManager().getShaderUniform("Radius") ==
- null
- ) {
+ if (blurShaderHorz.getShaderManager().getShaderUniform("Radius") == null) {
//Corrupted shader?
return;
}
- blurShaderHorz
- .getShaderManager()
- .getShaderUniform("Radius")
- .set(blurFactor);
- blurShaderVert
- .getShaderManager()
- .getShaderUniform("Radius")
- .set(blurFactor);
+ blurShaderHorz.getShaderManager().getShaderUniform("Radius").set(blurFactor);
+ blurShaderVert.getShaderManager().getShaderUniform("Radius").set(blurFactor);
GL11.glPushMatrix();
/*GL30.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, Minecraft.getMinecraft().getFramebuffer().framebufferObject);
@@ -237,16 +202,7 @@ public class BackgroundBlur {
int blurWidth,
int blurHeight
) {
- renderBlurredBackground(
- blurStrength,
- screenWidth,
- screenHeight,
- x,
- y,
- blurWidth,
- blurHeight,
- false
- );
+ renderBlurredBackground(blurStrength, screenWidth, screenHeight, x, y, blurWidth, blurHeight, false);
}
/**
@@ -263,10 +219,7 @@ public class BackgroundBlur {
int blurHeight,
boolean forcedUpdate
) {
- if (
- !OpenGlHelper.isFramebufferEnabled() ||
- !OpenGlHelper.areShadersSupported()
- ) return;
+ if (!OpenGlHelper.isFramebufferEnabled() || !OpenGlHelper.areShadersSupported()) return;
if (blurStrength < 0.5) return;
requestedBlurs.add(blurStrength);
@@ -292,16 +245,7 @@ public class BackgroundBlur {
Gui.drawRect(x, y, x + blurWidth, y + blurHeight, fogColour);
fb.bindFramebufferTexture();
GlStateManager.color(1f, 1f, 1f, 1f);
- RenderUtils.drawTexturedRect(
- x,
- y,
- blurWidth,
- blurHeight,
- uMin,
- uMax,
- vMin,
- vMax
- );
+ RenderUtils.drawTexturedRect(x, y, blurWidth, blurHeight, uMin, uMax, vMin, vMax);
fb.unbindFramebufferTexture();
GlStateManager.depthMask(true);
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/ChromaColour.java b/src/main/java/com/thatgravyboat/skyblockhud/core/ChromaColour.java
index b8e97ee..3137153 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/ChromaColour.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/ChromaColour.java
@@ -5,24 +5,12 @@ import java.awt.*;
public class ChromaColour {
public static String special(int chromaSpeed, int alpha, int rgb) {
- return special(
- chromaSpeed,
- alpha,
- (rgb & 0xFF0000) >> 16,
- (rgb & 0x00FF00) >> 8,
- (rgb & 0x0000FF)
- );
+ return special(chromaSpeed, alpha, (rgb & 0xFF0000) >> 16, (rgb & 0x00FF00) >> 8, (rgb & 0x0000FF));
}
private static final int RADIX = 10;
- public static String special(
- int chromaSpeed,
- int alpha,
- int r,
- int g,
- int b
- ) {
+ public static String special(int chromaSpeed, int alpha, int r, int g, int b) {
StringBuilder sb = new StringBuilder();
sb.append(Integer.toString(chromaSpeed, RADIX)).append(":");
sb.append(Integer.toString(alpha, RADIX)).append(":");
@@ -51,9 +39,7 @@ public class ChromaColour {
int a = d[3];
int chr = d[4];
- return (
- (a & 0xFF) << 24 | (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF)
- );
+ return ((a & 0xFF) << 24 | (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF));
}
public static int getSpeed(String special) {
@@ -61,12 +47,7 @@ public class ChromaColour {
}
public static float getSecondsForSpeed(int speed) {
- return (
- (255 - speed) /
- 254f *
- (MAX_CHROMA_SECS - MIN_CHROMA_SECS) +
- MIN_CHROMA_SECS
- );
+ return ((255 - speed) / 254f * (MAX_CHROMA_SECS - MIN_CHROMA_SECS) + MIN_CHROMA_SECS);
}
private static final int MIN_CHROMA_SECS = 1;
@@ -88,16 +69,12 @@ public class ChromaColour {
if (chr > 0) {
float seconds = getSecondsForSpeed(chr);
- hsv[0] +=
- (System.currentTimeMillis() - startTime) / 1000f / seconds;
+ hsv[0] += (System.currentTimeMillis() - startTime) / 1000f / seconds;
hsv[0] %= 1;
if (hsv[0] < 0) hsv[0] += 1;
}
- return (
- (a & 0xFF) << 24 |
- (Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0x00FFFFFF)
- );
+ return ((a & 0xFF) << 24 | (Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0x00FFFFFF));
}
public static int rotateHue(int argb, int degrees) {
@@ -111,9 +88,6 @@ public class ChromaColour {
hsv[0] += degrees / 360f;
hsv[0] %= 1;
- return (
- (a & 0xFF) << 24 |
- (Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0x00FFFFFF)
- );
+ return ((a & 0xFF) << 24 | (Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0x00FFFFFF));
}
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/GlScissorStack.java b/src/main/java/com/thatgravyboat/skyblockhud/core/GlScissorStack.java
index 306565e..0e1694e 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/GlScissorStack.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/GlScissorStack.java
@@ -40,24 +40,13 @@ public class GlScissorStack {
public void set(ScaledResolution scaledResolution) {
int height = Minecraft.getMinecraft().displayHeight;
int scale = scaledResolution.getScaleFactor();
- GL11.glScissor(
- left * scale,
- height - bottom * scale,
- (right - left) * scale,
- (bottom - top) * scale
- );
+ GL11.glScissor(left * scale, height - bottom * scale, (right - left) * scale, (bottom - top) * scale);
}
}
private static final LinkedList<Bounds> boundsStack = new LinkedList<>();
- public static void push(
- int left,
- int top,
- int right,
- int bottom,
- ScaledResolution scaledResolution
- ) {
+ public static void push(int left, int top, int right, int bottom, ScaledResolution scaledResolution) {
if (right < left) {
int temp = right;
right = left;
@@ -71,9 +60,7 @@ public class GlScissorStack {
if (boundsStack.isEmpty()) {
boundsStack.push(new Bounds(left, top, right, bottom));
} else {
- boundsStack.push(
- boundsStack.peek().createSubBound(left, top, right, bottom)
- );
+ boundsStack.push(boundsStack.peek().createSubBound(left, top, right, bottom));
}
if (!boundsStack.isEmpty()) {
boundsStack.peek().set(scaledResolution);
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementBoolean.java b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementBoolean.java
index a8ed7d5..e41b7b3 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementBoolean.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementBoolean.java
@@ -24,22 +24,11 @@ public class GuiElementBoolean extends GuiElement {
private static final int xSize = 48;
private static final int ySize = 14;
- public GuiElementBoolean(
- int x,
- int y,
- boolean value,
- Consumer<Boolean> toggleCallback
- ) {
+ public GuiElementBoolean(int x, int y, boolean value, Consumer<Boolean> toggleCallback) {
this(x, y, value, 0, toggleCallback);
}
- public GuiElementBoolean(
- int x,
- int y,
- boolean value,
- int clickRadius,
- Consumer<Boolean> toggleCallback
- ) {
+ public GuiElementBoolean(int x, int y, boolean value, int clickRadius, Consumer<Boolean> toggleCallback) {
this.x = x;
this.y = y;
this.value = value;
@@ -54,10 +43,7 @@ public class GuiElementBoolean extends GuiElement {
@Override
public void render() {
GlStateManager.color(1, 1, 1, 1);
- Minecraft
- .getMinecraft()
- .getTextureManager()
- .bindTexture(GuiTextures.BAR);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.BAR);
RenderUtils.drawTexturedRect(x, y, xSize, ySize);
ResourceLocation buttonLoc = GuiTextures.ON;
@@ -66,10 +52,7 @@ public class GuiElementBoolean extends GuiElement {
lastMillis = currentMillis;
boolean passedLimit = false;
if (previewValue != value) {
- if (
- (previewValue && animation > 12) ||
- (!previewValue && animation < 24)
- ) {
+ if ((previewValue && animation > 12) || (!previewValue && animation < 24)) {
passedLimit = true;
}
}
@@ -96,9 +79,7 @@ public class GuiElementBoolean extends GuiElement {
}
}
- int animation = (int) (
- LerpUtils.sigmoidZeroOne(this.animation / 36f) * 36
- );
+ int animation = (int) (LerpUtils.sigmoidZeroOne(this.animation / 36f) * 36);
if (animation < 3) {
buttonLoc = GuiTextures.OFF;
} else if (animation < 13) {
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementColour.java b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementColour.java
index 8b5c2d6..a7db23b 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementColour.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementColour.java
@@ -31,9 +31,7 @@ public class GuiElementColour extends GuiElement {
"skyblockhud:core/colour_selector_chroma.png"
);
- private static final ResourceLocation colourPickerLocation = new ResourceLocation(
- "mbcore:dynamic/colourpicker"
- );
+ private static final ResourceLocation colourPickerLocation = new ResourceLocation("mbcore:dynamic/colourpicker");
private static final ResourceLocation colourPickerBarValueLocation = new ResourceLocation(
"mbcore:dynamic/colourpickervalue"
);
@@ -42,9 +40,7 @@ public class GuiElementColour extends GuiElement {
);
private final GuiElementTextField hexField = new GuiElementTextField(
"",
- GuiElementTextField.SCALE_TEXT |
- GuiElementTextField.FORCE_CAPS |
- GuiElementTextField.NO_SPACE
+ GuiElementTextField.SCALE_TEXT | GuiElementTextField.FORCE_CAPS | GuiElementTextField.NO_SPACE
);
private int x;
@@ -68,20 +64,10 @@ public class GuiElementColour extends GuiElement {
Consumer<String> colourChangedCallback,
Runnable closeCallback
) {
- final ScaledResolution scaledResolution = new ScaledResolution(
- Minecraft.getMinecraft()
- );
+ final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- this.y =
- Math.max(
- 10,
- Math.min(scaledResolution.getScaledHeight() - ySize - 10, y)
- );
- this.x =
- Math.max(
- 10,
- Math.min(scaledResolution.getScaledWidth() - xSize - 10, x)
- );
+ this.y = Math.max(10, Math.min(scaledResolution.getScaledHeight() - ySize - 10, y));
+ this.x = Math.max(10, Math.min(scaledResolution.getScaledWidth() - xSize - 10, x));
this.colour = initialColour;
this.colourChangedCallback = colourChangedCallback;
@@ -89,12 +75,7 @@ public class GuiElementColour extends GuiElement {
int colour = ChromaColour.specialToSimpleRGB(initialColour);
Color c = new Color(colour);
- float[] hsv = Color.RGBtoHSB(
- c.getRed(),
- c.getGreen(),
- c.getBlue(),
- null
- );
+ float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
updateAngleAndRadius(hsv);
}
@@ -108,51 +89,25 @@ public class GuiElementColour extends GuiElement {
int currentColour = ChromaColour.specialToSimpleRGB(colour);
Color c = new Color(currentColour, true);
- float[] hsv = Color.RGBtoHSB(
- c.getRed(),
- c.getGreen(),
- c.getBlue(),
- null
- );
+ float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
- BufferedImage bufferedImage = new BufferedImage(
- 288,
- 288,
- BufferedImage.TYPE_INT_ARGB
- );
+ BufferedImage bufferedImage = new BufferedImage(288, 288, BufferedImage.TYPE_INT_ARGB);
float borderRadius = 0.05f;
if (Keyboard.isKeyDown(Keyboard.KEY_N)) borderRadius = 0;
for (int x = -16; x < 272; x++) {
for (int y = -16; y < 272; y++) {
- float radius = (float) Math.sqrt(
- ((x - 128) * (x - 128) + (y - 128) * (y - 128)) / 16384f
- );
- float angle = (float) Math.toDegrees(
- Math.atan((128 - x) / (y - 128 + 1E-5)) + Math.PI / 2
- );
+ float radius = (float) Math.sqrt(((x - 128) * (x - 128) + (y - 128) * (y - 128)) / 16384f);
+ float angle = (float) Math.toDegrees(Math.atan((128 - x) / (y - 128 + 1E-5)) + Math.PI / 2);
if (y < 128) angle += 180;
if (radius <= 1) {
- int rgb = Color
- .getHSBColor(
- angle / 360f,
- (float) Math.pow(radius, 1.5f),
- hsv[2]
- )
- .getRGB();
+ int rgb = Color.getHSBColor(angle / 360f, (float) Math.pow(radius, 1.5f), hsv[2]).getRGB();
bufferedImage.setRGB(x + 16, y + 16, rgb);
} else if (radius <= 1 + borderRadius) {
- float invBlackAlpha =
- Math.abs(radius - 1 - borderRadius / 2) /
- borderRadius *
- 2;
+ float invBlackAlpha = Math.abs(radius - 1 - borderRadius / 2) / borderRadius * 2;
float blackAlpha = 1 - invBlackAlpha;
if (radius > 1 + borderRadius / 2) {
- bufferedImage.setRGB(
- x + 16,
- y + 16,
- (int) (blackAlpha * 255) << 24
- );
+ bufferedImage.setRGB(x + 16, y + 16, (int) (blackAlpha * 255) << 24);
} else {
Color col = Color.getHSBColor(angle / 360f, 1, hsv[2]);
int rgb = (int) (col.getRed() * invBlackAlpha) << 16 |
@@ -164,34 +119,22 @@ public class GuiElementColour extends GuiElement {
}
}
- BufferedImage bufferedImageValue = new BufferedImage(
- 10,
- 64,
- BufferedImage.TYPE_INT_ARGB
- );
+ BufferedImage bufferedImageValue = new BufferedImage(10, 64, BufferedImage.TYPE_INT_ARGB);
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 64; y++) {
if ((x == 0 || x == 9) && (y == 0 || y == 63)) continue;
- int rgb = Color
- .getHSBColor(wheelAngle / 360, wheelRadius, (64 - y) / 64f)
- .getRGB();
+ int rgb = Color.getHSBColor(wheelAngle / 360, wheelRadius, (64 - y) / 64f).getRGB();
bufferedImageValue.setRGB(x, y, rgb);
}
}
- BufferedImage bufferedImageOpacity = new BufferedImage(
- 10,
- 64,
- BufferedImage.TYPE_INT_ARGB
- );
+ BufferedImage bufferedImageOpacity = new BufferedImage(10, 64, BufferedImage.TYPE_INT_ARGB);
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 64; y++) {
if ((x == 0 || x == 9) && (y == 0 || y == 63)) continue;
- int rgb =
- (currentColour & 0x00FFFFFF) |
- (Math.min(255, (64 - y) * 4) << 24);
+ int rgb = (currentColour & 0x00FFFFFF) | (Math.min(255, (64 - y) * 4) << 24);
bufferedImageOpacity.setRGB(x, y, rgb);
}
}
@@ -200,68 +143,30 @@ public class GuiElementColour extends GuiElement {
int selx = (int) (Math.cos(Math.toRadians(wheelAngle)) * selradius);
int sely = (int) (Math.sin(Math.toRadians(wheelAngle)) * selradius);
- Minecraft
- .getMinecraft()
- .getTextureManager()
- .bindTexture(colour_selector_bar_alpha);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_bar_alpha);
GlStateManager.color(1, 1, 1, 1);
- RenderUtils.drawTexturedRect(
- x + 5 + 64 + 5 + 10 + 5,
- y + 5,
- 10,
- 64,
- GL11.GL_NEAREST
- );
+ RenderUtils.drawTexturedRect(x + 5 + 64 + 5 + 10 + 5, y + 5, 10, 64, GL11.GL_NEAREST);
Minecraft
.getMinecraft()
.getTextureManager()
- .loadTexture(
- colourPickerBarValueLocation,
- new DynamicTexture(bufferedImageValue)
- );
- Minecraft
- .getMinecraft()
- .getTextureManager()
- .bindTexture(colourPickerBarValueLocation);
+ .loadTexture(colourPickerBarValueLocation, new DynamicTexture(bufferedImageValue));
+ Minecraft.getMinecraft().getTextureManager().bindTexture(colourPickerBarValueLocation);
GlStateManager.color(1, 1, 1, 1);
- RenderUtils.drawTexturedRect(
- x + 5 + 64 + 5,
- y + 5,
- 10,
- 64,
- GL11.GL_NEAREST
- );
+ RenderUtils.drawTexturedRect(x + 5 + 64 + 5, y + 5, 10, 64, GL11.GL_NEAREST);
Minecraft
.getMinecraft()
.getTextureManager()
- .loadTexture(
- colourPickerBarOpacityLocation,
- new DynamicTexture(bufferedImageOpacity)
- );
- Minecraft
- .getMinecraft()
- .getTextureManager()
- .bindTexture(colourPickerBarOpacityLocation);
+ .loadTexture(colourPickerBarOpacityLocation, new DynamicTexture(bufferedImageOpacity));
+ Minecraft.getMinecraft().getTextureManager().bindTexture(colourPickerBarOpacityLocation);
GlStateManager.color(1, 1, 1, 1);
- RenderUtils.drawTexturedRect(
- x + 5 + 64 + 5 + 10 + 5,
- y + 5,
- 10,
- 64,
- GL11.GL_NEAREST
- );
+ RenderUtils.drawTexturedRect(x + 5 + 64 + 5 + 10 + 5, y + 5, 10, 64, GL11.GL_NEAREST);
int chromaSpeed = ChromaColour.getSpeed(colour);
int currentColourChroma = ChromaColour.specialToChromaRGB(colour);
Color cChroma = new Color(currentColourChroma, true);
- float hsvChroma[] = Color.RGBtoHSB(
- cChroma.getRed(),
- cChroma.getGreen(),
- cChroma.getBlue(),
- null
- );
+ float hsvChroma[] = Color.RGBtoHSB(cChroma.getRed(), cChroma.getGreen(), cChroma.getBlue(), null);
if (chromaSpeed > 0) {
Gui.drawRect(
@@ -278,58 +183,23 @@ public class GuiElementColour extends GuiElement {
x + 5 + 64 + 5 + 10 + 5 + 10 + 5 + 10 - 1,
y + 5 + 37 - 1,
Color.HSBtoRGB(
- (
- hsvChroma[0] +
- (System.currentTimeMillis() - ChromaColour.startTime) /
- 1000f
- ) %
- 1,
+ (hsvChroma[0] + (System.currentTimeMillis() - ChromaColour.startTime) / 1000f) % 1,
0.8f,
0.8f
)
);
}
- Minecraft
- .getMinecraft()
- .getTextureManager()
- .bindTexture(colour_selector_bar);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_bar);
GlStateManager.color(1, 1, 1, 1);
- RenderUtils.drawTexturedRect(
- x + 5 + 64 + 5,
- y + 5,
- 10,
- 64,
- GL11.GL_NEAREST
- );
- RenderUtils.drawTexturedRect(
- x + 5 + 64 + 5 + 10 + 5,
- y + 5,
- 10,
- 64,
- GL11.GL_NEAREST
- );
+ RenderUtils.drawTexturedRect(x + 5 + 64 + 5, y + 5, 10, 64, GL11.GL_NEAREST);
+ RenderUtils.drawTexturedRect(x + 5 + 64 + 5 + 10 + 5, y + 5, 10, 64, GL11.GL_NEAREST);
if (chromaSpeed > 0) {
- RenderUtils.drawTexturedRect(
- x + 5 + 64 + 5 + 10 + 5 + 10 + 5,
- y + 5,
- 10,
- 64,
- GL11.GL_NEAREST
- );
+ RenderUtils.drawTexturedRect(x + 5 + 64 + 5 + 10 + 5 + 10 + 5, y + 5, 10, 64, GL11.GL_NEAREST);
} else {
- Minecraft
- .getMinecraft()
- .getTextureManager()
- .bindTexture(colour_selector_chroma);
- RenderUtils.drawTexturedRect(
- x + 5 + 64 + 5 + 10 + 5 + 10 + 5,
- y + 5 + 27,
- 10,
- 10,
- GL11.GL_NEAREST
- );
+ Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_chroma);
+ RenderUtils.drawTexturedRect(x + 5 + 64 + 5 + 10 + 5 + 10 + 5, y + 5 + 27, 10, 10, GL11.GL_NEAREST);
}
Gui.drawRect(
@@ -359,29 +229,14 @@ public class GuiElementColour extends GuiElement {
Minecraft
.getMinecraft()
.getTextureManager()
- .loadTexture(
- colourPickerLocation,
- new DynamicTexture(bufferedImage)
- );
- Minecraft
- .getMinecraft()
- .getTextureManager()
- .bindTexture(colourPickerLocation);
+ .loadTexture(colourPickerLocation, new DynamicTexture(bufferedImage));
+ Minecraft.getMinecraft().getTextureManager().bindTexture(colourPickerLocation);
GlStateManager.color(1, 1, 1, 1);
RenderUtils.drawTexturedRect(x + 1, y + 1, 72, 72, GL11.GL_LINEAR);
- Minecraft
- .getMinecraft()
- .getTextureManager()
- .bindTexture(colour_selector_dot);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_dot);
GlStateManager.color(1, 1, 1, 1);
- RenderUtils.drawTexturedRect(
- x + 5 + 32 + selx - 4,
- y + 5 + 32 + sely - 4,
- 8,
- 8,
- GL11.GL_NEAREST
- );
+ RenderUtils.drawTexturedRect(x + 5 + 32 + selx - 4, y + 5 + 32 + sely - 4, 8, 8, GL11.GL_NEAREST);
TextRenderUtils.drawStringCenteredScaledMaxWidth(
EnumChatFormatting.GRAY.toString() + Math.round(hsv[2] * 100) + "",
@@ -393,9 +248,7 @@ public class GuiElementColour extends GuiElement {
-1
);
TextRenderUtils.drawStringCenteredScaledMaxWidth(
- EnumChatFormatting.GRAY.toString() +
- Math.round(c.getAlpha() / 255f * 100) +
- "",
+ EnumChatFormatting.GRAY.toString() + Math.round(c.getAlpha() / 255f * 100) + "",
Minecraft.getMinecraft().fontRendererObj,
x + 5 + 64 + 5 + 15 + 5,
y + 5 + 64 + 5 + 5,
@@ -405,9 +258,7 @@ public class GuiElementColour extends GuiElement {
);
if (chromaSpeed > 0) {
TextRenderUtils.drawStringCenteredScaledMaxWidth(
- EnumChatFormatting.GRAY.toString() +
- (int) ChromaColour.getSecondsForSpeed(chromaSpeed) +
- "s",
+ EnumChatFormatting.GRAY.toString() + (int) ChromaColour.getSecondsForSpeed(chromaSpeed) + "s",
Minecraft.getMinecraft().fontRendererObj,
x + 5 + 64 + 5 + 30 + 6,
y + 5 + 64 + 5 + 5,
@@ -418,9 +269,7 @@ public class GuiElementColour extends GuiElement {
}
hexField.setSize(48, 10);
- if (!hexField.getFocus()) hexField.setText(
- Integer.toHexString(c.getRGB() & 0xFFFFFF).toUpperCase()
- );
+ if (!hexField.getFocus()) hexField.setText(Integer.toHexString(c.getRGB() & 0xFFFFFF).toUpperCase());
StringBuilder sb = new StringBuilder(EnumChatFormatting.GRAY + "#");
for (int i = 0; i < 6 - hexField.getText().length(); i++) {
@@ -433,13 +282,9 @@ public class GuiElementColour extends GuiElement {
}
public boolean mouseInput(int mouseX, int mouseY) {
- ScaledResolution scaledResolution = new ScaledResolution(
- Minecraft.getMinecraft()
- );
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
float mouseXF = (float) (
- Mouse.getX() *
- scaledResolution.getScaledWidth_double() /
- Minecraft.getMinecraft().displayWidth
+ Mouse.getX() * scaledResolution.getScaledWidth_double() / Minecraft.getMinecraft().displayWidth
);
float mouseYF = (float) (
scaledResolution.getScaledHeight_double() -
@@ -449,17 +294,10 @@ public class GuiElementColour extends GuiElement {
1
);
- if (
- (Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1) &&
- Mouse.getEventButtonState()
- ) {
+ if ((Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1) && Mouse.getEventButtonState()) {
if (mouseX > x + 5 + 8 && mouseX < x + 5 + 8 + 48) {
if (mouseY > y + 5 + 64 + 5 && mouseY < y + 5 + 64 + 5 + 10) {
- hexField.mouseClicked(
- mouseX,
- mouseY,
- Mouse.getEventButton()
- );
+ hexField.mouseClicked(mouseX, mouseY, Mouse.getEventButton());
clickedComponent = -1;
return true;
}
@@ -469,12 +307,7 @@ public class GuiElementColour extends GuiElement {
clickedComponent = -1;
}
if (Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
- if (
- mouseX >= x &&
- mouseX <= x + 119 &&
- mouseY >= y &&
- mouseY <= y + 89
- ) {
+ if (mouseX >= x && mouseX <= x + 119 && mouseY >= y && mouseY <= y + 89) {
hexField.unfocus();
int xWheel = mouseX - x - 5;
@@ -508,19 +341,10 @@ public class GuiElementColour extends GuiElement {
if (y > -5 && y <= 69) {
clickedComponent = 3;
}
- } else if (
- mouseY > this.y + 5 + 27 && mouseY < this.y + 5 + 37
- ) {
- int currentColour = ChromaColour.specialToSimpleRGB(
- colour
- );
+ } else if (mouseY > this.y + 5 + 27 && mouseY < this.y + 5 + 37) {
+ int currentColour = ChromaColour.specialToSimpleRGB(colour);
Color c = new Color(currentColour, true);
- colour =
- ChromaColour.special(
- 200,
- c.getAlpha(),
- currentColour
- );
+ colour = ChromaColour.special(200, c.getAlpha(), currentColour);
colourChangedCallback.accept(colour);
}
}
@@ -533,46 +357,24 @@ public class GuiElementColour extends GuiElement {
if (Mouse.isButtonDown(0) && clickedComponent >= 0) {
int currentColour = ChromaColour.specialToSimpleRGB(colour);
Color c = new Color(currentColour, true);
- float[] hsv = Color.RGBtoHSB(
- c.getRed(),
- c.getGreen(),
- c.getBlue(),
- null
- );
+ float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
float xWheel = mouseXF - x - 5;
float yWheel = mouseYF - y - 5;
if (clickedComponent == 0) {
- float angle = (float) Math.toDegrees(
- Math.atan((32 - xWheel) / (yWheel - 32 + 1E-5)) +
- Math.PI /
- 2
- );
+ float angle = (float) Math.toDegrees(Math.atan((32 - xWheel) / (yWheel - 32 + 1E-5)) + Math.PI / 2);
xWheel = Math.max(0, Math.min(64, xWheel));
yWheel = Math.max(0, Math.min(64, yWheel));
float radius = (float) Math.sqrt(
- (
- (xWheel - 32) *
- (xWheel - 32) +
- (yWheel - 32) *
- (yWheel - 32)
- ) /
- 1024f
+ ((xWheel - 32) * (xWheel - 32) + (yWheel - 32) * (yWheel - 32)) / 1024f
);
if (yWheel < 32) angle += 180;
this.wheelAngle = angle;
this.wheelRadius = (float) Math.pow(Math.min(1, radius), 1.5f);
- int rgb = Color
- .getHSBColor(angle / 360f, wheelRadius, hsv[2])
- .getRGB();
- colour =
- ChromaColour.special(
- ChromaColour.getSpeed(colour),
- c.getAlpha(),
- rgb
- );
+ int rgb = Color.getHSBColor(angle / 360f, wheelRadius, hsv[2]).getRGB();
+ colour = ChromaColour.special(ChromaColour.getSpeed(colour), c.getAlpha(), rgb);
colourChangedCallback.accept(colour);
return true;
}
@@ -582,37 +384,21 @@ public class GuiElementColour extends GuiElement {
System.out.println(y);
if (clickedComponent == 1) {
- int rgb = Color
- .getHSBColor(wheelAngle / 360, wheelRadius, 1 - y / 64f)
- .getRGB();
- colour =
- ChromaColour.special(
- ChromaColour.getSpeed(colour),
- c.getAlpha(),
- rgb
- );
+ int rgb = Color.getHSBColor(wheelAngle / 360, wheelRadius, 1 - y / 64f).getRGB();
+ colour = ChromaColour.special(ChromaColour.getSpeed(colour), c.getAlpha(), rgb);
colourChangedCallback.accept(colour);
return true;
}
if (clickedComponent == 2) {
colour =
- ChromaColour.special(
- ChromaColour.getSpeed(colour),
- 255 - Math.round(y / 64f * 255),
- currentColour
- );
+ ChromaColour.special(ChromaColour.getSpeed(colour), 255 - Math.round(y / 64f * 255), currentColour);
colourChangedCallback.accept(colour);
return true;
}
if (clickedComponent == 3) {
- colour =
- ChromaColour.special(
- 255 - Math.round(y / 64f * 255),
- c.getAlpha(),
- currentColour
- );
+ colour = ChromaColour.special(255 - Math.round(y / 64f * 255), c.getAlpha(), currentColour);
colourChangedCallback.accept(colour);
}
return true;
@@ -628,10 +414,7 @@ public class GuiElementColour extends GuiElement {
}
String old = hexField.getText();
- hexField.keyTyped(
- Keyboard.getEventCharacter(),
- Keyboard.getEventKey()
- );
+ hexField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
if (hexField.getText().length() > 6) {
hexField.setText(old);
@@ -640,23 +423,12 @@ public class GuiElementColour extends GuiElement {
String text = hexField.getText().toLowerCase();
int rgb = Integer.parseInt(text, 16);
- int alpha =
- (ChromaColour.specialToSimpleRGB(colour) >> 24) & 0xFF;
- colour =
- ChromaColour.special(
- ChromaColour.getSpeed(colour),
- alpha,
- rgb
- );
+ int alpha = (ChromaColour.specialToSimpleRGB(colour) >> 24) & 0xFF;
+ colour = ChromaColour.special(ChromaColour.getSpeed(colour), alpha, rgb);
colourChangedCallback.accept(colour);
Color c = new Color(rgb);
- float[] hsv = Color.RGBtoHSB(
- c.getRed(),
- c.getGreen(),
- c.getBlue(),
- null
- );
+ float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
updateAngleAndRadius(hsv);
} catch (Exception e) {}
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementTextField.java b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementTextField.java
index a3d01b5..cc002b2 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementTextField.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementTextField.java
@@ -34,14 +34,7 @@ public class GuiElementTextField {
private String prependText = "";
- private final GuiTextField textField = new GuiTextField(
- 0,
- Minecraft.getMinecraft().fontRendererObj,
- 0,
- 0,
- 0,
- 0
- );
+ private final GuiTextField textField = new GuiTextField(0, Minecraft.getMinecraft().fontRendererObj, 0, 0, 0, 0);
private int customBorderColour = -1;
@@ -49,12 +42,7 @@ public class GuiElementTextField {
this(initialText, 100, 20, options);
}
- public GuiElementTextField(
- String initialText,
- int sizeX,
- int sizeY,
- int options
- ) {
+ public GuiElementTextField(String initialText, int sizeX, int sizeY, int options) {
textField.setFocused(true);
textField.setCanLoseFocus(false);
textField.setMaxStringLength(999);
@@ -109,18 +97,10 @@ public class GuiElementTextField {
}
public int getHeight() {
- ScaledResolution scaledresolution = new ScaledResolution(
- Minecraft.getMinecraft()
- );
- int paddingUnscaled =
- searchBarPadding / scaledresolution.getScaleFactor();
-
- int numLines =
- org.apache.commons.lang3.StringUtils.countMatches(
- textField.getText(),
- "\n"
- ) +
- 1;
+ ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
+ int paddingUnscaled = searchBarPadding / scaledresolution.getScaleFactor();
+
+ int numLines = org.apache.commons.lang3.StringUtils.countMatches(textField.getText(), "\n") + 1;
int extraSize = (searchBarYSize - 8) / 2 + 8;
int bottomTextBox = searchBarYSize + extraSize * (numLines - 1);
@@ -128,21 +108,14 @@ public class GuiElementTextField {
}
public int getWidth() {
- ScaledResolution scaledresolution = new ScaledResolution(
- Minecraft.getMinecraft()
- );
- int paddingUnscaled =
- searchBarPadding / scaledresolution.getScaleFactor();
+ ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
+ int paddingUnscaled = searchBarPadding / scaledresolution.getScaleFactor();
return searchBarXSize + paddingUnscaled * 2;
}
private float getScaleFactor(String str) {
- return Math.min(
- 1,
- (searchBarXSize - 2) /
- (float) Minecraft.getMinecraft().fontRendererObj.getStringWidth(str)
- );
+ return Math.min(1, (searchBarXSize - 2) / (float) Minecraft.getMinecraft().fontRendererObj.getStringWidth(str));
}
private boolean isScaling() {
@@ -151,10 +124,7 @@ public class GuiElementTextField {
private float getStringWidth(String str) {
if (isScaling()) {
- return (
- Minecraft.getMinecraft().fontRendererObj.getStringWidth(str) *
- getScaleFactor(str)
- );
+ return (Minecraft.getMinecraft().fontRendererObj.getStringWidth(str) * getScaleFactor(str));
} else {
return Minecraft.getMinecraft().fontRendererObj.getStringWidth(str);
}
@@ -168,13 +138,9 @@ public class GuiElementTextField {
String renderText = prependText + textField.getText();
- int lineNum = Math.round(
- ((yComp - (searchBarYSize - 8) / 2)) / extraSize
- );
+ int lineNum = Math.round(((yComp - (searchBarYSize - 8) / 2)) / extraSize);
- Pattern patternControlCode = Pattern.compile(
- "(?i)\\u00A7([^\\u00B6])(?!\\u00B6)"
- );
+ Pattern patternControlCode = Pattern.compile("(?i)\\u00A7([^\\u00B6])(?!\\u00B6)");
String text = renderText;
String textNoColour = renderText;
if ((options & COLOUR) != 0) {
@@ -202,28 +168,15 @@ public class GuiElementTextField {
}
String textNC = textNoColour.substring(0, cursorIndex);
- int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(
- textNC,
- "\u00B6"
- );
- String line = text
- .substring(
- cursorIndex + (((options & COLOUR) != 0) ? colorCodes * 2 : 0)
- )
- .split("\n")[0];
+ int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(textNC, "\u00B6");
+ String line = text.substring(cursorIndex + (((options & COLOUR) != 0) ? colorCodes * 2 : 0)).split("\n")[0];
int padding = Math.min(5, searchBarXSize - strLenNoColor(line)) / 2;
- String trimmed = Minecraft
- .getMinecraft()
- .fontRendererObj.trimStringToWidth(line, xComp - padding);
+ String trimmed = Minecraft.getMinecraft().fontRendererObj.trimStringToWidth(line, xComp - padding);
int linePos = strLenNoColor(trimmed);
if (linePos != strLenNoColor(line)) {
char after = line.charAt(linePos);
- int trimmedWidth = Minecraft
- .getMinecraft()
- .fontRendererObj.getStringWidth(trimmed);
- int charWidth = Minecraft
- .getMinecraft()
- .fontRendererObj.getCharWidth(after);
+ int trimmedWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(trimmed);
+ int charWidth = Minecraft.getMinecraft().fontRendererObj.getCharWidth(after);
if (trimmedWidth + charWidth / 2 < xComp - padding) {
linePos++;
}
@@ -258,12 +211,7 @@ public class GuiElementTextField {
return str.replaceAll("(?i)\\u00A7.", "").length();
}
- public void mouseClickMove(
- int mouseX,
- int mouseY,
- int clickedMouseButton,
- long timeSinceLastClick
- ) {
+ public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
if (focus) {
textField.setSelectionPos(getCursorPos(mouseX, mouseY));
}
@@ -272,9 +220,7 @@ public class GuiElementTextField {
public void keyTyped(char typedChar, int keyCode) {
if (focus) {
if ((options & MULTILINE) != 0) { //Carriage return
- Pattern patternControlCode = Pattern.compile(
- "(?i)\\u00A7([^\\u00B6\n])(?!\\u00B6)"
- );
+ Pattern patternControlCode = Pattern.compile("(?i)\\u00A7([^\\u00B6\n])(?!\\u00B6)");
String text = textField.getText();
String textNoColour = textField.getText();
@@ -282,8 +228,7 @@ public class GuiElementTextField {
Matcher matcher = patternControlCode.matcher(text);
if (!matcher.find() || matcher.groupCount() < 1) break;
String code = matcher.group(1);
- text =
- matcher.replaceFirst("\u00A7" + code + "\u00B6" + code);
+ text = matcher.replaceFirst("\u00A7" + code + "\u00B6" + code);
}
while (true) {
Matcher matcher = patternControlCode.matcher(textNoColour);
@@ -293,29 +238,16 @@ public class GuiElementTextField {
}
if (keyCode == 28) {
- String before = textField
- .getText()
- .substring(0, textField.getCursorPosition());
- String after = textField
- .getText()
- .substring(textField.getCursorPosition());
+ String before = textField.getText().substring(0, textField.getCursorPosition());
+ String after = textField.getText().substring(textField.getCursorPosition());
int pos = textField.getCursorPosition();
textField.setText(before + "\n" + after);
textField.setCursorPosition(pos + 1);
return;
} else if (keyCode == 200) { //Up
- String textNCBeforeCursor = textNoColour.substring(
- 0,
- textField.getSelectionEnd()
- );
- int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(
- textNCBeforeCursor,
- "\u00B6"
- );
- String textBeforeCursor = text.substring(
- 0,
- textField.getSelectionEnd() + colorCodes * 2
- );
+ String textNCBeforeCursor = textNoColour.substring(0, textField.getSelectionEnd());
+ int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(textNCBeforeCursor, "\u00B6");
+ String textBeforeCursor = text.substring(0, textField.getSelectionEnd() + colorCodes * 2);
int numLinesBeforeCursor = org.apache.commons.lang3.StringUtils.countMatches(
textBeforeCursor,
@@ -326,9 +258,7 @@ public class GuiElementTextField {
int textBeforeCursorWidth;
String lineBefore;
String thisLineBeforeCursor;
- if (
- split.length == numLinesBeforeCursor && split.length > 0
- ) {
+ if (split.length == numLinesBeforeCursor && split.length > 0) {
textBeforeCursorWidth = 0;
lineBefore = split[split.length - 1];
thisLineBeforeCursor = "";
@@ -336,32 +266,19 @@ public class GuiElementTextField {
thisLineBeforeCursor = split[split.length - 1];
lineBefore = split[split.length - 2];
textBeforeCursorWidth =
- Minecraft
- .getMinecraft()
- .fontRendererObj.getStringWidth(
- thisLineBeforeCursor
- );
+ Minecraft.getMinecraft().fontRendererObj.getStringWidth(thisLineBeforeCursor);
} else {
return;
}
String trimmed = Minecraft
.getMinecraft()
- .fontRendererObj.trimStringToWidth(
- lineBefore,
- textBeforeCursorWidth
- );
+ .fontRendererObj.trimStringToWidth(lineBefore, textBeforeCursorWidth);
int linePos = strLenNoColor(trimmed);
if (linePos != strLenNoColor(lineBefore)) {
char after = lineBefore.charAt(linePos);
- int trimmedWidth = Minecraft
- .getMinecraft()
- .fontRendererObj.getStringWidth(trimmed);
- int charWidth = Minecraft
- .getMinecraft()
- .fontRendererObj.getCharWidth(after);
- if (
- trimmedWidth + charWidth / 2 < textBeforeCursorWidth
- ) {
+ int trimmedWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(trimmed);
+ int charWidth = Minecraft.getMinecraft().fontRendererObj.getCharWidth(after);
+ if (trimmedWidth + charWidth / 2 < textBeforeCursorWidth) {
linePos++;
}
}
@@ -378,18 +295,9 @@ public class GuiElementTextField {
textField.setCursorPosition(newPos);
}
} else if (keyCode == 208) { //Down
- String textNCBeforeCursor = textNoColour.substring(
- 0,
- textField.getSelectionEnd()
- );
- int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(
- textNCBeforeCursor,
- "\u00B6"
- );
- String textBeforeCursor = text.substring(
- 0,
- textField.getSelectionEnd() + colorCodes * 2
- );
+ String textNCBeforeCursor = textNoColour.substring(0, textField.getSelectionEnd());
+ int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(textNCBeforeCursor, "\u00B6");
+ String textBeforeCursor = text.substring(0, textField.getSelectionEnd() + colorCodes * 2);
int numLinesBeforeCursor = org.apache.commons.lang3.StringUtils.countMatches(
textBeforeCursor,
@@ -405,11 +313,7 @@ public class GuiElementTextField {
} else if (split.length > 0) {
thisLineBeforeCursor = split[split.length - 1];
textBeforeCursorWidth =
- Minecraft
- .getMinecraft()
- .fontRendererObj.getStringWidth(
- thisLineBeforeCursor
- );
+ Minecraft.getMinecraft().fontRendererObj.getStringWidth(thisLineBeforeCursor);
} else {
return;
}
@@ -419,25 +323,13 @@ public class GuiElementTextField {
String lineAfter = split2[numLinesBeforeCursor + 1];
String trimmed = Minecraft
.getMinecraft()
- .fontRendererObj.trimStringToWidth(
- lineAfter,
- textBeforeCursorWidth
- );
+ .fontRendererObj.trimStringToWidth(lineAfter, textBeforeCursorWidth);
int linePos = strLenNoColor(trimmed);
if (linePos != strLenNoColor(lineAfter)) {
char after = lineAfter.charAt(linePos);
- int trimmedWidth = Minecraft
- .getMinecraft()
- .fontRendererObj.getStringWidth(trimmed);
- int charWidth = Minecraft
- .getMinecraft()
- .fontRendererObj.getCharWidth(after);
- if (
- trimmedWidth +
- charWidth /
- 2 <
- textBeforeCursorWidth
- ) {
+ int trimmedWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(trimmed);
+ int charWidth = Minecraft.getMinecraft().fontRendererObj.getCharWidth(after);
+ if (trimmedWidth + charWidth / 2 < textBeforeCursorWidth) {
linePos++;
}
}
@@ -458,8 +350,7 @@ public class GuiElementTextField {
}
String old = textField.getText();
- if ((options & FORCE_CAPS) != 0) typedChar =
- Character.toUpperCase(typedChar);
+ if ((options & FORCE_CAPS) != 0) typedChar = Character.toUpperCase(typedChar);
if ((options & NO_SPACE) != 0 && typedChar == ' ') return;
textField.setFocused(true);
@@ -470,9 +361,7 @@ public class GuiElementTextField {
int pos = textField.getCursorPosition() - 2;
if (pos >= 0 && pos < textField.getText().length()) {
if (textField.getText().charAt(pos) == '&') {
- String before = textField
- .getText()
- .substring(0, pos);
+ String before = textField.getText().substring(0, pos);
String after = "";
if (pos + 2 < textField.getText().length()) {
after = textField.getText().substring(pos + 2);
@@ -484,25 +373,14 @@ public class GuiElementTextField {
}
}
- if (
- (options & NUM_ONLY) != 0 &&
- textField.getText().matches("[^0-9.]")
- ) textField.setText(old);
+ if ((options & NUM_ONLY) != 0 && textField.getText().matches("[^0-9.]")) textField.setText(old);
}
}
public void render(int x, int y) {
this.x = x;
this.y = y;
- drawTextbox(
- x,
- y,
- searchBarXSize,
- searchBarYSize,
- searchBarPadding,
- textField,
- focus
- );
+ drawTextbox(x, y, searchBarXSize, searchBarYSize, searchBarPadding, textField, focus);
}
private void drawTextbox(
@@ -514,9 +392,7 @@ public class GuiElementTextField {
GuiTextField textField,
boolean focus
) {
- ScaledResolution scaledresolution = new ScaledResolution(
- Minecraft.getMinecraft()
- );
+ ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
String renderText = prependText + textField.getText();
GlStateManager.disableLighting();
@@ -524,16 +400,10 @@ public class GuiElementTextField {
/**
* Search bar
*/
- int paddingUnscaled =
- searchBarPadding / scaledresolution.getScaleFactor();
+ int paddingUnscaled = searchBarPadding / scaledresolution.getScaleFactor();
if (paddingUnscaled < 1) paddingUnscaled = 1;
- int numLines =
- org.apache.commons.lang3.StringUtils.countMatches(
- renderText,
- "\n"
- ) +
- 1;
+ int numLines = org.apache.commons.lang3.StringUtils.countMatches(renderText, "\n") + 1;
int extraSize = (searchBarYSize - 8) / 2 + 8;
int bottomTextBox = y + searchBarYSize + extraSize * (numLines - 1);
@@ -549,18 +419,10 @@ public class GuiElementTextField {
bottomTextBox + paddingUnscaled,
borderColour
);
- Gui.drawRect(
- x,
- y,
- x + searchBarXSize,
- bottomTextBox,
- Color.BLACK.getRGB()
- );
+ Gui.drawRect(x, y, x + searchBarXSize, bottomTextBox, Color.BLACK.getRGB());
//bar text
- Pattern patternControlCode = Pattern.compile(
- "(?i)\\u00A7([^\\u00B6\n])(?!\\u00B6)"
- );
+ Pattern patternControlCode = Pattern.compile("(?i)\\u00A7([^\\u00B6\n])(?!\\u00B6)");
String text = renderText;
String textNoColor = renderText;
@@ -587,23 +449,13 @@ public class GuiElementTextField {
if (
isScaling() &&
- Minecraft
- .getMinecraft()
- .fontRendererObj.getStringWidth(texts[yOffI]) >
- searchBarXSize -
- 10
+ Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]) > searchBarXSize - 10
) {
scale =
(searchBarXSize - 2) /
- (float) Minecraft
- .getMinecraft()
- .fontRendererObj.getStringWidth(texts[yOffI]);
+ (float) Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]);
if (scale > 1) scale = 1;
- float newLen =
- Minecraft
- .getMinecraft()
- .fontRendererObj.getStringWidth(texts[yOffI]) *
- scale;
+ float newLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]) * scale;
xStartOffset = (int) ((searchBarXSize - newLen) / 2f);
TextRenderUtils.drawStringCenteredScaledMaxWidth(
@@ -619,10 +471,7 @@ public class GuiElementTextField {
Minecraft
.getMinecraft()
.fontRendererObj.drawString(
- StringUtils.trimToWidth(
- texts[yOffI],
- searchBarXSize - 10
- ),
+ StringUtils.trimToWidth(texts[yOffI], searchBarXSize - 10),
x + 5,
y + (searchBarYSize - 8) / 2 + yOff,
Color.WHITE.getRGB()
@@ -631,25 +480,14 @@ public class GuiElementTextField {
}
if (focus && System.currentTimeMillis() % 1000 > 500) {
- String textNCBeforeCursor = textNoColor.substring(
- 0,
- textField.getCursorPosition() + prependText.length()
- );
- int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(
- textNCBeforeCursor,
- "\u00B6"
- );
+ String textNCBeforeCursor = textNoColor.substring(0, textField.getCursorPosition() + prependText.length());
+ int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(textNCBeforeCursor, "\u00B6");
String textBeforeCursor = text.substring(
0,
- textField.getCursorPosition() +
- prependText.length() +
- (((options & COLOUR) != 0) ? colorCodes * 2 : 0)
+ textField.getCursorPosition() + prependText.length() + (((options & COLOUR) != 0) ? colorCodes * 2 : 0)
);
- int numLinesBeforeCursor = org.apache.commons.lang3.StringUtils.countMatches(
- textBeforeCursor,
- "\n"
- );
+ int numLinesBeforeCursor = org.apache.commons.lang3.StringUtils.countMatches(textBeforeCursor, "\n");
int yOff = numLinesBeforeCursor * extraSize;
String[] split = textBeforeCursor.split("\n");
@@ -658,14 +496,7 @@ public class GuiElementTextField {
textBeforeCursorWidth = 0;
} else {
textBeforeCursorWidth =
- (int) (
- Minecraft
- .getMinecraft()
- .fontRendererObj.getStringWidth(
- split[split.length - 1]
- ) *
- scale
- );
+ (int) (Minecraft.getMinecraft().fontRendererObj.getStringWidth(split[split.length - 1]) * scale);
}
Gui.drawRect(
x + xStartOffset + textBeforeCursorWidth,
@@ -701,16 +532,7 @@ public class GuiElementTextField {
char c = textNoColor.charAt(i);
if (sectionSignPrev) {
- if (
- c != 'k' &&
- c != 'K' &&
- c != 'm' &&
- c != 'M' &&
- c != 'n' &&
- c != 'N' &&
- c != 'o' &&
- c != 'O'
- ) {
+ if (c != 'k' && c != 'K' && c != 'm' && c != 'M' && c != 'n' && c != 'N' && c != 'o' && c != 'O') {
bold = c == 'l' || c == 'L';
}
sectionSignPrev = false;
@@ -739,12 +561,8 @@ public class GuiElementTextField {
//String c2 = bold ? EnumChatFormatting.BOLD.toString() : "" + c;
- System.out.println(
- "Adding len for char:" + c + ":" + Integer.toHexString(c)
- );
- int len = Minecraft
- .getMinecraft()
- .fontRendererObj.getStringWidth(String.valueOf(c));
+ System.out.println("Adding len for char:" + c + ":" + Integer.toHexString(c));
+ int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(String.valueOf(c));
if (bold) len++;
if (i >= leftIndex && i < rightIndex) {
Gui.drawRect(
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiScreenElementWrapper.java b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiScreenElementWrapper.java
index 747d7c5..326c85f 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiScreenElementWrapper.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiScreenElementWrapper.java
@@ -22,12 +22,7 @@ public class GuiScreenElementWrapper extends GuiScreen {
public void handleMouseInput() throws IOException {
super.handleMouseInput();
int i = Mouse.getEventX() * this.width / this.mc.displayWidth;
- int j =
- this.height -
- Mouse.getEventY() *
- this.height /
- this.mc.displayHeight -
- 1;
+ int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
element.mouseInput(i, j);
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/Position.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/Position.java
index 0151e76..0b3a1f5 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/Position.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/Position.java
@@ -93,11 +93,7 @@ public class Position {
return ret;
}
- public int moveX(
- int deltaX,
- int objWidth,
- ScaledResolution scaledResolution
- ) {
+ public int moveX(int deltaX, int objWidth, ScaledResolution scaledResolution) {
int screenWidth = scaledResolution.getScaledWidth();
boolean wasPositiveX = this.x >= 0;
this.x += deltaX;
@@ -146,11 +142,7 @@ public class Position {
return deltaX;
}
- public int moveY(
- int deltaY,
- int objHeight,
- ScaledResolution scaledResolution
- ) {
+ public int moveY(int deltaY, int objHeight, ScaledResolution scaledResolution) {
int screenHeight = scaledResolution.getScaledHeight();
boolean wasPositiveY = this.y >= 0;
this.y += deltaY;
@@ -199,13 +191,7 @@ public class Position {
return deltaY;
}
- public boolean rightAligned(
- ScaledResolution scaledResolution,
- int objWidth
- ) {
- return (
- this.getAbsX(scaledResolution, objWidth) >
- (scaledResolution.getScaledWidth() / 2)
- );
+ public boolean rightAligned(ScaledResolution scaledResolution, int objWidth) {
+ return (this.getAbsX(scaledResolution, objWidth) > (scaledResolution.getScaledWidth() / 2));
}
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditor.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditor.java
index 5dfcecc..85aa0b7 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditor.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditor.java
@@ -33,9 +33,7 @@ public abstract class GuiOptionEditor {
int maxLines = 5;
float scale = 1;
- int lineCount = fr
- .listFormattedStringToWidth(option.desc, width * 2 / 3 - 10)
- .size();
+ int lineCount = fr.listFormattedStringToWidth(option.desc, width * 2 / 3 - 10).size();
if (lineCount <= 0) return;
@@ -43,31 +41,15 @@ public abstract class GuiOptionEditor {
while (paraHeight >= HEIGHT - 10) {
scale -= 1 / 8f;
- lineCount =
- fr
- .listFormattedStringToWidth(
- option.desc,
- (int) (width * 2 / 3 / scale - 10)
- )
- .size();
+ lineCount = fr.listFormattedStringToWidth(option.desc, (int) (width * 2 / 3 / scale - 10)).size();
paraHeight = (int) (9 * scale * lineCount - 1 * scale);
}
GlStateManager.pushMatrix();
- GlStateManager.translate(
- x + 5 + width / 3f,
- y + HEIGHT / 2f - paraHeight / 2,
- 0
- );
+ GlStateManager.translate(x + 5 + width / 3f, y + HEIGHT / 2f - paraHeight / 2, 0);
GlStateManager.scale(scale, scale, 1);
- fr.drawSplitString(
- option.desc,
- 0,
- 0,
- (int) (width * 2 / 3 / scale - 10),
- 0xc0c0c0
- );
+ fr.drawSplitString(option.desc, 0, 0, (int) (width * 2 / 3 / scale - 10), 0xc0c0c0);
GlStateManager.popMatrix();
}
@@ -76,23 +58,11 @@ public abstract class GuiOptionEditor {
return HEIGHT;
}
- public abstract boolean mouseInput(
- int x,
- int y,
- int width,
- int mouseX,
- int mouseY
- );
+ public abstract boolean mouseInput(int x, int y, int width, int mouseX, int mouseY);
public abstract boolean keyboardInput();
- public boolean mouseInputOverlay(
- int x,
- int y,
- int width,
- int mouseX,
- int mouseY
- ) {
+ public boolean mouseInputOverlay(int x, int y, int width, int mouseX, int mouseY) {
return false;
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorAccordion.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorAccordion.java
index 5270c01..7888587 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorAccordion.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorAccordion.java
@@ -16,10 +16,7 @@ public class GuiOptionEditorAccordion extends GuiOptionEditor {
private int accordionId;
private boolean accordionToggled;
- public GuiOptionEditorAccordion(
- ConfigProcessor.ProcessedOption option,
- int accordionId
- ) {
+ public GuiOptionEditorAccordion(ConfigProcessor.ProcessedOption option, int accordionId) {
super(option);
this.accordionToggled = (boolean) option.get();
this.accordionId = accordionId;
@@ -52,19 +49,11 @@ public class GuiOptionEditorAccordion extends GuiOptionEditor {
worldrenderer.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION);
if (accordionToggled) {
worldrenderer.pos((double) x + 6, (double) y + 6, 0.0D).endVertex();
- worldrenderer
- .pos((double) x + 9.75f, (double) y + 13.5f, 0.0D)
- .endVertex();
- worldrenderer
- .pos((double) x + 13.5f, (double) y + 6, 0.0D)
- .endVertex();
+ worldrenderer.pos((double) x + 9.75f, (double) y + 13.5f, 0.0D).endVertex();
+ worldrenderer.pos((double) x + 13.5f, (double) y + 6, 0.0D).endVertex();
} else {
- worldrenderer
- .pos((double) x + 6, (double) y + 13.5f, 0.0D)
- .endVertex();
- worldrenderer
- .pos((double) x + 13.5f, (double) y + 9.75f, 0.0D)
- .endVertex();
+ worldrenderer.pos((double) x + 6, (double) y + 13.5f, 0.0D).endVertex();
+ worldrenderer.pos((double) x + 13.5f, (double) y + 9.75f, 0.0D).endVertex();
worldrenderer.pos((double) x + 6, (double) y + 6, 0.0D).endVertex();
}
tessellator.draw();
@@ -84,13 +73,7 @@ public class GuiOptionEditorAccordion extends GuiOptionEditor {
@Override
public boolean mouseInput(int x, int y, int width, int mouseX, int mouseY) {
- if (
- Mouse.getEventButtonState() &&
- mouseX > x &&
- mouseX < x + width &&
- mouseY > y &&
- mouseY < y + getHeight()
- ) {
+ if (Mouse.getEventButtonState() && mouseX > x && mouseX < x + width && mouseY > y && mouseY < y + getHeight()) {
accordionToggled = !accordionToggled;
return true;
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorBoolean.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorBoolean.java
index 508a7cc..4167e06 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorBoolean.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorBoolean.java
@@ -9,14 +9,7 @@ public class GuiOptionEditorBoolean extends GuiOptionEditor {
public GuiOptionEditorBoolean(ConfigProcessor.ProcessedOption option) {
super(option);
- bool =
- new GuiElementBoolean(
- 0,
- 0,
- (boolean) option.get(),
- 10,
- option::set
- );
+ bool = new GuiElementBoolean(0, 0, (boolean) option.get(), 10, option::set);
}
@Override
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorButton.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorButton.java
index 01fb7bd..7868ece 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorButton.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorButton.java
@@ -28,9 +28,7 @@ public class GuiOptionEditorButton extends GuiOptionEditor {
this.config = config;
this.buttonText = buttonText;
- if (
- this.buttonText != null && this.buttonText.isEmpty()
- ) this.buttonText = null;
+ if (this.buttonText != null && this.buttonText.isEmpty()) this.buttonText = null;
}
@Override
@@ -41,12 +39,7 @@ public class GuiOptionEditorButton extends GuiOptionEditor {
GlStateManager.color(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(button_tex);
- RenderUtils.drawTexturedRect(
- x + width / 6 - 24,
- y + height - 7 - 14,
- 48,
- 16
- );
+ RenderUtils.drawTexturedRect(x + width / 6 - 24, y + height - 7 - 14, 48, 16);
if (buttonText != null) {
TextRenderUtils.drawStringCenteredScaledMaxWidth(
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorColour.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorColour.java
index ed44e5d..e64d14c 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorColour.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorColour.java
@@ -31,12 +31,7 @@ public class GuiOptionEditorColour extends GuiOptionEditor {
int b = argb & 0xFF;
GlStateManager.color(r / 255f, g / 255f, b / 255f, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(button_white);
- RenderUtils.drawTexturedRect(
- x + width / 6f - 24,
- y + height - 7 - 14,
- 48,
- 16
- );
+ RenderUtils.drawTexturedRect(x + width / 6f - 24, y + height - 7 - 14, 48, 16);
}
@Override
@@ -47,16 +42,8 @@ public class GuiOptionEditorColour extends GuiOptionEditor {
}
@Override
- public boolean mouseInputOverlay(
- int x,
- int y,
- int width,
- int mouseX,
- int mouseY
- ) {
- return (
- colourElement != null && colourElement.mouseInput(mouseX, mouseY)
- );
+ public boolean mouseInputOverlay(int x, int y, int width, int mouseX, int mouseY) {
+ return (colourElement != null && colourElement.mouseInput(mouseX, mouseY));
}
@Override
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDraggableList.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDraggableList.java
index 619e144..11175a3 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDraggableList.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDraggableList.java
@@ -21,9 +21,7 @@ import org.lwjgl.opengl.GL11;
public class GuiOptionEditorDraggableList extends GuiOptionEditor {
- private static final ResourceLocation DELETE = new ResourceLocation(
- "notenoughupdates:core/delete.png"
- );
+ private static final ResourceLocation DELETE = new ResourceLocation("notenoughupdates:core/delete.png");
private String[] exampleText;
private List<Integer> activeText;
@@ -37,10 +35,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
private boolean dropdownOpen = false;
- public GuiOptionEditorDraggableList(
- ConfigProcessor.ProcessedOption option,
- String[] exampleText
- ) {
+ public GuiOptionEditorDraggableList(ConfigProcessor.ProcessedOption option, String[] exampleText) {
super(option);
this.exampleText = exampleText;
this.activeText = (List<Integer>) option.get();
@@ -66,12 +61,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
GlStateManager.color(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(button_tex);
- RenderUtils.drawTexturedRect(
- x + width / 6f - 24,
- y + 45 - 7 - 14,
- 48,
- 16
- );
+ RenderUtils.drawTexturedRect(x + width / 6f - 24, y + 45 - 7 - 14, 48, 16);
TextRenderUtils.drawStringCenteredScaledMaxWidth(
"Add",
@@ -85,18 +75,11 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
long currentTime = System.currentTimeMillis();
float greenBlue = LerpUtils.clampZeroOne(
- ((trashHoverTime < 0 ? 250 : 0) + trashHoverTime - currentTime) /
- 250f
+ ((trashHoverTime < 0 ? 250 : 0) + trashHoverTime - currentTime) / 250f
);
GlStateManager.color(1, greenBlue, greenBlue, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(DELETE);
- Utils.drawTexturedRect(
- x + width / 6f + 27,
- y + 45 - 7 - 13,
- 11,
- 14,
- GL11.GL_NEAREST
- );
+ Utils.drawTexturedRect(x + width / 6f + 27, y + 45 - 7 - 13, 11, 14, GL11.GL_NEAREST);
Gui.drawRect(x + 5, y + 45, x + width - 5, y + height - 5, 0xffdddddd);
Gui.drawRect(x + 6, y + 46, x + width - 6, y + height - 6, 0xff000000);
@@ -111,11 +94,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
int ySize = multilines.length * 10;
if (i++ != dragStartIndex) {
- for (
- int multilineIndex = 0;
- multilineIndex < multilines.length;
- multilineIndex++
- ) {
+ for (int multilineIndex = 0; multilineIndex < multilines.length; multilineIndex++) {
String line = multilines[multilineIndex];
Utils.drawStringScaledMaxWidth(
line + EnumChatFormatting.RESET,
@@ -129,13 +108,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
}
Minecraft
.getMinecraft()
- .fontRendererObj.drawString(
- "\u2261",
- x + 10,
- y + 50 + yOff + ySize / 2f - 4,
- 0xffffff,
- true
- );
+ .fontRendererObj.drawString("\u2261", x + 10, y + 50 + yOff + ySize / 2f - 4, 0xffffff, true);
}
yOff += ySize;
@@ -164,27 +137,9 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
int outline = 0xff404046;
Gui.drawRect(left, top, left + 1, top + dropdownHeight, outline); //Left
Gui.drawRect(left + 1, top, left + dropdownWidth, top + 1, outline); //Top
- Gui.drawRect(
- left + dropdownWidth - 1,
- top + 1,
- left + dropdownWidth,
- top + dropdownHeight,
- outline
- ); //Right
- Gui.drawRect(
- left + 1,
- top + dropdownHeight - 1,
- left + dropdownWidth - 1,
- top + dropdownHeight,
- outline
- ); //Bottom
- Gui.drawRect(
- left + 1,
- top + 1,
- left + dropdownWidth - 1,
- top + dropdownHeight - 1,
- main
- ); //Middle
+ Gui.drawRect(left + dropdownWidth - 1, top + 1, left + dropdownWidth, top + dropdownHeight, outline); //Right
+ Gui.drawRect(left + 1, top + dropdownHeight - 1, left + dropdownWidth - 1, top + dropdownHeight, outline); //Bottom
+ Gui.drawRect(left + 1, top + 1, left + dropdownWidth - 1, top + dropdownHeight - 1, main); //Middle
int dropdownY = -1;
for (int strIndex : remaining) {
@@ -207,26 +162,17 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
int opacity = 0x80;
long currentTime = System.currentTimeMillis();
if (trashHoverTime < 0) {
- float greenBlue = LerpUtils.clampZeroOne(
- (currentTime + trashHoverTime) / 250f
- );
+ float greenBlue = LerpUtils.clampZeroOne((currentTime + trashHoverTime) / 250f);
opacity = (int) (opacity * greenBlue);
} else {
- float greenBlue = LerpUtils.clampZeroOne(
- (250 + trashHoverTime - currentTime) / 250f
- );
+ float greenBlue = LerpUtils.clampZeroOne((250 + trashHoverTime - currentTime) / 250f);
opacity = (int) (opacity * greenBlue);
}
if (opacity < 20) return;
- ScaledResolution scaledResolution = new ScaledResolution(
- Minecraft.getMinecraft()
- );
- int mouseX =
- Mouse.getX() *
- scaledResolution.getScaledWidth() /
- Minecraft.getMinecraft().displayWidth;
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ int mouseX = Mouse.getX() * scaledResolution.getScaledWidth() / Minecraft.getMinecraft().displayWidth;
int mouseY =
scaledResolution.getScaledHeight() -
Mouse.getY() *
@@ -239,11 +185,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
String[] multilines = str.split("\n");
GlStateManager.enableBlend();
- for (
- int multilineIndex = 0;
- multilineIndex < multilines.length;
- multilineIndex++
- ) {
+ for (int multilineIndex = 0; multilineIndex < multilines.length; multilineIndex++) {
String line = multilines[multilineIndex];
Utils.drawStringScaledMaxWidth(
line + EnumChatFormatting.RESET,
@@ -291,8 +233,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
if (!Mouse.isButtonDown(0) || dropdownOpen) {
currentDragging = -1;
dragStartIndex = -1;
- if (trashHoverTime > 0) trashHoverTime =
- -System.currentTimeMillis();
+ if (trashHoverTime > 0) trashHoverTime = -System.currentTimeMillis();
} else if (
currentDragging >= 0 &&
mouseX >= x + width / 6 + 27 - 3 &&
@@ -302,8 +243,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
) {
if (trashHoverTime < 0) trashHoverTime = System.currentTimeMillis();
} else {
- if (trashHoverTime > 0) trashHoverTime =
- -System.currentTimeMillis();
+ if (trashHoverTime > 0) trashHoverTime = -System.currentTimeMillis();
}
if (Mouse.getEventButtonState()) {
@@ -322,12 +262,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
int dropdownHeight = -1 + 12 * remaining.size();
- if (
- mouseX > left &&
- mouseX < left + dropdownWidth &&
- mouseY > top &&
- mouseY < top + dropdownHeight
- ) {
+ if (mouseX > left && mouseX < left + dropdownWidth && mouseY > top && mouseY < top + dropdownHeight) {
int dropdownY = -1;
for (int strIndex : remaining) {
if (mouseY < top + dropdownY + 12) {
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDropdown.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDropdown.java
index 8aa5c08..43a04d7 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDropdown.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDropdown.java
@@ -47,13 +47,7 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor {
selectedString = values[selected];
}
- RenderUtils.drawFloatingRectDark(
- left,
- top,
- dropdownWidth,
- 14,
- false
- );
+ RenderUtils.drawFloatingRectDark(left, top, dropdownWidth, 14, false);
TextRenderUtils.drawStringScaled(
"\u25BC",
fr,
@@ -97,35 +91,11 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor {
int blue = 0xff2355ad;
Gui.drawRect(left, top, left + 1, top + dropdownHeight, blue); //Left
Gui.drawRect(left + 1, top, left + dropdownWidth, top + 1, blue); //Top
- Gui.drawRect(
- left + dropdownWidth - 1,
- top + 1,
- left + dropdownWidth,
- top + dropdownHeight,
- blue
- ); //Right
- Gui.drawRect(
- left + 1,
- top + dropdownHeight - 1,
- left + dropdownWidth - 1,
- top + dropdownHeight,
- blue
- ); //Bottom
- Gui.drawRect(
- left + 1,
- top + 1,
- left + dropdownWidth - 1,
- top + dropdownHeight - 1,
- main
- ); //Middle
-
- Gui.drawRect(
- left + 1,
- top + 14 - 1,
- left + dropdownWidth - 1,
- top + 14,
- blue
- ); //Bar
+ Gui.drawRect(left + dropdownWidth - 1, top + 1, left + dropdownWidth, top + dropdownHeight, blue); //Right
+ Gui.drawRect(left + 1, top + dropdownHeight - 1, left + dropdownWidth - 1, top + dropdownHeight, blue); //Bottom
+ Gui.drawRect(left + 1, top + 1, left + dropdownWidth - 1, top + dropdownHeight - 1, main); //Middle
+
+ Gui.drawRect(left + 1, top + 14 - 1, left + dropdownWidth - 1, top + 14, blue); //Bar
int dropdownY = 13;
for (String option : values) {
@@ -174,12 +144,7 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor {
int top = y + height - 7 - 14;
if (Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
- if (
- mouseX >= left &&
- mouseX <= left + 80 &&
- mouseY >= top &&
- mouseY <= top + 14
- ) {
+ if (mouseX >= left && mouseX <= left + 80 && mouseY >= top && mouseY <= top + 14) {
open = !open;
return true;
}
@@ -189,36 +154,19 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor {
}
@Override
- public boolean mouseInputOverlay(
- int x,
- int y,
- int width,
- int mouseX,
- int mouseY
- ) {
+ public boolean mouseInputOverlay(int x, int y, int width, int mouseX, int mouseY) {
int height = getHeight();
int left = x + width / 6 - 40;
int top = y + height - 7 - 14;
if (Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
- if (
- !(
- mouseX >= left &&
- mouseX <= left + 80 &&
- mouseY >= top &&
- mouseY <= top + 14
- ) &&
- open
- ) {
+ if (!(mouseX >= left && mouseX <= left + 80 && mouseY >= top && mouseY <= top + 14) && open) {
open = false;
if (mouseX >= left && mouseX <= left + 80) {
int dropdownY = 13;
for (int ordinal = 0; ordinal < values.length; ordinal++) {
- if (
- mouseY >= top + 3 + dropdownY &&
- mouseY <= top + 3 + dropdownY + 12
- ) {
+ if (mouseY >= top + 3 + dropdownY && mouseY <= top + 3 + dropdownY + 12) {
selected = ordinal;
if (useOrdinal) {
option.set(selected);
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorSlider.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorSlider.java
index dd981d8..2932e34 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorSlider.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorSlider.java
@@ -33,9 +33,7 @@ public class GuiOptionEditorSlider extends GuiOptionEditor {
textField =
new GuiElementTextField(
strVal,
- GuiElementTextField.NO_SPACE |
- GuiElementTextField.NUM_ONLY |
- GuiElementTextField.SCALE_TEXT
+ GuiElementTextField.NO_SPACE | GuiElementTextField.NUM_ONLY | GuiElementTextField.SCALE_TEXT
);
}
@@ -56,8 +54,7 @@ public class GuiOptionEditorSlider extends GuiOptionEditor {
strVal = Integer.toString(val.intValue());
} else {
strVal = Float.toString(val);
- strVal =
- strVal.replaceAll("(\\.\\d\\d\\d)(?:\\d)+", "$1");
+ strVal = strVal.replaceAll("(\\.\\d\\d\\d)(?:\\d)+", "$1");
strVal = strVal.replaceAll("0+$", "");
}
textField.setText(strVal);
@@ -80,29 +77,16 @@ public class GuiOptionEditorSlider extends GuiOptionEditor {
slider.render();
if (textField.getFocus()) {
- textField.setOptions(
- GuiElementTextField.NO_SPACE | GuiElementTextField.NUM_ONLY
- );
- textField.setSize(
- Minecraft
- .getMinecraft()
- .fontRendererObj.getStringWidth(textField.getText()) +
- 10,
- 16
- );
+ textField.setOptions(GuiElementTextField.NO_SPACE | GuiElementTextField.NUM_ONLY);
+ textField.setSize(Minecraft.getMinecraft().fontRendererObj.getStringWidth(textField.getText()) + 10, 16);
} else {
textField.setSize(textFieldWidth, 16);
textField.setOptions(
- GuiElementTextField.NO_SPACE |
- GuiElementTextField.NUM_ONLY |
- GuiElementTextField.SCALE_TEXT
+ GuiElementTextField.NO_SPACE | GuiElementTextField.NUM_ONLY | GuiElementTextField.SCALE_TEXT
);
}
- textField.render(
- x + width / 6 - fullWidth / 2 + sliderWidth + 5,
- y + height - 7 - 14
- );
+ textField.render(x + width / 6 - fullWidth / 2 + sliderWidth + 5, y + height - 7 - 14);
}
@Override
@@ -122,21 +106,14 @@ public class GuiOptionEditorSlider extends GuiOptionEditor {
}
if (textField.getFocus()) {
- textFieldWidth =
- Minecraft
- .getMinecraft()
- .fontRendererObj.getStringWidth(textField.getText()) +
- 10;
+ textFieldWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(textField.getText()) + 10;
}
int textFieldX = x + width / 6 - fullWidth / 2 + sliderWidth + 5;
int textFieldY = y + height - 7 - 14;
textField.setSize(textFieldWidth, 16);
- if (
- Mouse.getEventButtonState() &&
- (Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1)
- ) {
+ if (Mouse.getEventButtonState() && (Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1)) {
if (
mouseX > textFieldX &&
mouseX < textFieldX + textFieldWidth &&
@@ -155,10 +132,7 @@ public class GuiOptionEditorSlider extends GuiOptionEditor {
@Override
public boolean keyboardInput() {
if (Keyboard.getEventKeyState() && textField.getFocus()) {
- textField.keyTyped(
- Keyboard.getEventCharacter(),
- Keyboard.getEventKey()
- );
+ textField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
try {
textField.setCustomBorderColour(0xffffffff);
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorText.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorText.java
index 3e712f2..da39ca1 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorText.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorText.java
@@ -27,13 +27,7 @@ public class GuiOptionEditorText extends GuiOptionEditor {
int textFieldX = x + width / 6 - fullWidth / 2;
if (textField.getFocus()) {
fullWidth =
- Math.max(
- fullWidth,
- Minecraft
- .getMinecraft()
- .fontRendererObj.getStringWidth(textField.getText()) +
- 10
- );
+ Math.max(fullWidth, Minecraft.getMinecraft().fontRendererObj.getStringWidth(textField.getText()) + 10);
}
textField.setSize(fullWidth, 16);
@@ -51,22 +45,13 @@ public class GuiOptionEditorText extends GuiOptionEditor {
if (textField.getFocus()) {
fullWidth =
- Math.max(
- fullWidth,
- Minecraft
- .getMinecraft()
- .fontRendererObj.getStringWidth(textField.getText()) +
- 10
- );
+ Math.max(fullWidth, Minecraft.getMinecraft().fontRendererObj.getStringWidth(textField.getText()) + 10);
}
int textFieldY = y + height - 7 - 14;
textField.setSize(fullWidth, 16);
- if (
- Mouse.getEventButtonState() &&
- (Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1)
- ) {
+ if (Mouse.getEventButtonState() && (Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1)) {
if (
mouseX > textFieldX &&
mouseX < textFieldX + fullWidth &&
@@ -86,10 +71,7 @@ public class GuiOptionEditorText extends GuiOptionEditor {
public boolean keyboardInput() {
if (Keyboard.getEventKeyState() && textField.getFocus()) {
Keyboard.enableRepeatEvents(true);
- textField.keyTyped(
- Keyboard.getEventCharacter(),
- Keyboard.getEventKey()
- );
+ textField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey());
try {
textField.setCustomBorderColour(0xffffffff);
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiPositionEditor.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiPositionEditor.java
index eaa399e..0fae02e 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiPositionEditor.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiPositionEditor.java
@@ -67,28 +67,13 @@ public class GuiPositionEditor extends GuiScreen {
this.width = scaledResolution.getScaledWidth();
this.height = scaledResolution.getScaledHeight();
mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
- mouseY =
- height -
- Mouse.getY() *
- height /
- Minecraft.getMinecraft().displayHeight -
- 1;
+ mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1;
drawDefaultBackground();
if (clicked) {
- grabbedX +=
- position.moveX(
- mouseX - grabbedX,
- elementWidth,
- scaledResolution
- );
- grabbedY +=
- position.moveY(
- mouseY - grabbedY,
- elementHeight,
- scaledResolution
- );
+ grabbedX += position.moveX(mouseX - grabbedX, elementWidth, scaledResolution);
+ grabbedY += position.moveY(mouseY - grabbedY, elementHeight, scaledResolution);
}
renderCallback.run();
@@ -124,8 +109,7 @@ public class GuiPositionEditor extends GuiScreen {
}
@Override
- protected void mouseClicked(int mouseX, int mouseY, int mouseButton)
- throws IOException {
+ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
if (mouseButton == 0) {
@@ -133,29 +117,17 @@ public class GuiPositionEditor extends GuiScreen {
if (guiScaleOverride >= 0) {
scaledResolution = Utils.pushGuiScale(guiScaleOverride);
} else {
- scaledResolution =
- new ScaledResolution(Minecraft.getMinecraft());
+ scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
}
- mouseX =
- Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
- mouseY =
- height -
- Mouse.getY() *
- height /
- Minecraft.getMinecraft().displayHeight -
- 1;
+ mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
+ mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1;
int x = position.getAbsX(scaledResolution, elementWidth);
int y = position.getAbsY(scaledResolution, elementHeight);
if (position.isCenterX()) x -= elementWidth / 2;
if (position.isCenterY()) y -= elementHeight / 2;
- if (
- mouseX >= x &&
- mouseY >= y &&
- mouseX <= x + elementWidth &&
- mouseY <= y + elementHeight
- ) {
+ if (mouseX >= x && mouseY >= y && mouseX <= x + elementWidth && mouseY <= y + elementHeight) {
clicked = true;
grabbedX = mouseX;
grabbedY = mouseY;
@@ -174,34 +146,16 @@ public class GuiPositionEditor extends GuiScreen {
if (keyCode == Keyboard.KEY_R) {
position.set(originalPosition);
} else if (!clicked) {
- boolean shiftHeld =
- Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ||
- Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
+ boolean shiftHeld = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
int dist = shiftHeld ? 10 : 1;
if (keyCode == Keyboard.KEY_DOWN) {
- position.moveY(
- dist,
- elementHeight,
- new ScaledResolution(Minecraft.getMinecraft())
- );
+ position.moveY(dist, elementHeight, new ScaledResolution(Minecraft.getMinecraft()));
} else if (keyCode == Keyboard.KEY_UP) {
- position.moveY(
- -dist,
- elementHeight,
- new ScaledResolution(Minecraft.getMinecraft())
- );
+ position.moveY(-dist, elementHeight, new ScaledResolution(Minecraft.getMinecraft()));
} else if (keyCode == Keyboard.KEY_LEFT) {
- position.moveX(
- -dist,
- elementWidth,
- new ScaledResolution(Minecraft.getMinecraft())
- );
+ position.moveX(-dist, elementWidth, new ScaledResolution(Minecraft.getMinecraft()));
} else if (keyCode == Keyboard.KEY_RIGHT) {
- position.moveX(
- dist,
- elementWidth,
- new ScaledResolution(Minecraft.getMinecraft())
- );
+ position.moveX(dist, elementWidth, new ScaledResolution(Minecraft.getMinecraft()));
}
}
super.keyTyped(typedChar, keyCode);
@@ -214,48 +168,21 @@ public class GuiPositionEditor extends GuiScreen {
}
@Override
- protected void mouseClickMove(
- int mouseX,
- int mouseY,
- int clickedMouseButton,
- long timeSinceLastClick
- ) {
- super.mouseClickMove(
- mouseX,
- mouseY,
- clickedMouseButton,
- timeSinceLastClick
- );
+ protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
+ super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
if (clicked) {
ScaledResolution scaledResolution;
if (guiScaleOverride >= 0) {
scaledResolution = Utils.pushGuiScale(guiScaleOverride);
} else {
- scaledResolution =
- new ScaledResolution(Minecraft.getMinecraft());
+ scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
}
- mouseX =
- Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
- mouseY =
- height -
- Mouse.getY() *
- height /
- Minecraft.getMinecraft().displayHeight -
- 1;
+ mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
+ mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1;
- grabbedX +=
- position.moveX(
- mouseX - grabbedX,
- elementWidth,
- scaledResolution
- );
- grabbedY +=
- position.moveY(
- mouseY - grabbedY,
- elementHeight,
- scaledResolution
- );
+ grabbedX += position.moveX(mouseX - grabbedX, elementWidth, scaledResolution);
+ grabbedY += position.moveY(mouseY - grabbedY, elementHeight, scaledResolution);
positionChangedCallback.run();
if (guiScaleOverride >= 0) {
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/struct/ConfigProcessor.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/struct/ConfigProcessor.java
index 559fa9e..e989b61 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/struct/ConfigProcessor.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/struct/ConfigProcessor.java
@@ -35,13 +35,7 @@ public class ConfigProcessor {
private final Field field;
private final Object container;
- public ProcessedOption(
- String name,
- String desc,
- int subcategoryId,
- Field field,
- Object container
- ) {
+ public ProcessedOption(String name, String desc, int subcategoryId, Field field, Object container) {
this.name = name;
this.desc = desc;
this.subcategoryId = subcategoryId;
@@ -73,17 +67,11 @@ public class ConfigProcessor {
}
}
- public static LinkedHashMap<String, ProcessedCategory> create(
- Config config
- ) {
+ public static LinkedHashMap<String, ProcessedCategory> create(Config config) {
LinkedHashMap<String, ProcessedCategory> processedConfig = new LinkedHashMap<>();
for (Field categoryField : config.getClass().getDeclaredFields()) {
- boolean exposePresent = categoryField.isAnnotationPresent(
- Expose.class
- );
- boolean categoryPresent = categoryField.isAnnotationPresent(
- Category.class
- );
+ boolean exposePresent = categoryField.isAnnotationPresent(Expose.class);
+ boolean categoryPresent = categoryField.isAnnotationPresent(Category.class);
if (exposePresent && categoryPresent) {
Object categoryObj;
@@ -94,26 +82,15 @@ public class ConfigProcessor {
continue;
}
- Category categoryAnnotation = categoryField.getAnnotation(
- Category.class
- );
- ProcessedCategory cat = new ProcessedCategory(
- categoryAnnotation.name(),
- categoryAnnotation.desc()
- );
+ Category categoryAnnotation = categoryField.getAnnotation(Category.class);
+ ProcessedCategory cat = new ProcessedCategory(categoryAnnotation.name(), categoryAnnotation.desc());
processedConfig.put(categoryField.getName(), cat);
- for (Field optionField : categoryObj
- .getClass()
- .getDeclaredFields()) {
- boolean optionPresent = optionField.isAnnotationPresent(
- ConfigOption.class
- );
+ for (Field optionField : categoryObj.getClass().getDeclaredFields()) {
+ boolean optionPresent = optionField.isAnnotationPresent(ConfigOption.class);
if (optionPresent) {
- ConfigOption optionAnnotation = optionField.getAnnotation(
- ConfigOption.class
- );
+ ConfigOption optionAnnotation = optionField.getAnnotation(ConfigOption.class);
ProcessedOption option = new ProcessedOption(
optionAnnotation.name(),
optionAnnotation.desc(),
@@ -121,24 +98,14 @@ public class ConfigProcessor {
optionField,
categoryObj
);
- if (
- optionField.isAnnotationPresent(
- ConfigAccordionId.class
- )
- ) {
- ConfigAccordionId annotation = optionField.getAnnotation(
- ConfigAccordionId.class
- );
+ if (optionField.isAnnotationPresent(ConfigAccordionId.class)) {
+ ConfigAccordionId annotation = optionField.getAnnotation(ConfigAccordionId.class);
option.accordionId = annotation.id();
}
GuiOptionEditor editor = null;
Class<?> optionType = optionField.getType();
- if (
- optionField.isAnnotationPresent(
- ConfigEditorButton.class
- )
- ) {
+ if (optionField.isAnnotationPresent(ConfigEditorButton.class)) {
ConfigEditorButton configEditorAnnotation = optionField.getAnnotation(
ConfigEditorButton.class
);
@@ -152,33 +119,21 @@ public class ConfigProcessor {
}
if (
optionType.isAssignableFrom(boolean.class) &&
- optionField.isAnnotationPresent(
- ConfigEditorBoolean.class
- )
+ optionField.isAnnotationPresent(ConfigEditorBoolean.class)
) {
editor = new GuiOptionEditorBoolean(option);
}
if (
optionType.isAssignableFrom(boolean.class) &&
- optionField.isAnnotationPresent(
- ConfigEditorAccordion.class
- )
+ optionField.isAnnotationPresent(ConfigEditorAccordion.class)
) {
ConfigEditorAccordion configEditorAnnotation = optionField.getAnnotation(
ConfigEditorAccordion.class
);
- editor =
- new GuiOptionEditorAccordion(
- option,
- configEditorAnnotation.id()
- );
+ editor = new GuiOptionEditorAccordion(option, configEditorAnnotation.id());
}
if (optionType.isAssignableFrom(int.class)) {
- if (
- optionField.isAnnotationPresent(
- ConfigEditorDropdown.class
- )
- ) {
+ if (optionField.isAnnotationPresent(ConfigEditorDropdown.class)) {
ConfigEditorDropdown configEditorAnnotation = optionField.getAnnotation(
ConfigEditorDropdown.class
);
@@ -192,27 +147,15 @@ public class ConfigProcessor {
}
}
if (optionType.isAssignableFrom(List.class)) {
- if (
- optionField.isAnnotationPresent(
- ConfigEditorDraggableList.class
- )
- ) {
+ if (optionField.isAnnotationPresent(ConfigEditorDraggableList.class)) {
ConfigEditorDraggableList configEditorAnnotation = optionField.getAnnotation(
ConfigEditorDraggableList.class
);
- editor =
- new GuiOptionEditorDraggableList(
- option,
- configEditorAnnotation.exampleText()
- );
+ editor = new GuiOptionEditorDraggableList(option, configEditorAnnotation.exampleText());
}
}
if (optionType.isAssignableFrom(String.class)) {
- if (
- optionField.isAnnotationPresent(
- ConfigEditorDropdown.class
- )
- ) {
+ if (optionField.isAnnotationPresent(ConfigEditorDropdown.class)) {
ConfigEditorDropdown configEditorAnnotation = optionField.getAnnotation(
ConfigEditorDropdown.class
);
@@ -223,17 +166,9 @@ public class ConfigProcessor {
configEditorAnnotation.initialIndex(),
false
);
- } else if (
- optionField.isAnnotationPresent(
- ConfigEditorColour.class
- )
- ) {
+ } else if (optionField.isAnnotationPresent(ConfigEditorColour.class)) {
editor = new GuiOptionEditorColour(option);
- } else if (
- optionField.isAnnotationPresent(
- ConfigEditorText.class
- )
- ) {
+ } else if (optionField.isAnnotationPresent(ConfigEditorText.class)) {
editor = new GuiOptionEditorText(option);
}
}
@@ -242,11 +177,7 @@ public class ConfigProcessor {
optionType.isAssignableFrom(float.class) ||
optionType.isAssignableFrom(double.class)
) {
- if (
- optionField.isAnnotationPresent(
- ConfigEditorSlider.class
- )
- ) {
+ if (optionField.isAnnotationPresent(ConfigEditorSlider.class)) {
ConfigEditorSlider configEditorAnnotation = optionField.getAnnotation(
ConfigEditorSlider.class
);
@@ -260,21 +191,11 @@ public class ConfigProcessor {
}
}
if (optionType.isAssignableFrom(String.class)) {
- if (
- optionField.isAnnotationPresent(
- ConfigEditorDropdown.class
- )
- ) {
+ if (optionField.isAnnotationPresent(ConfigEditorDropdown.class)) {
ConfigEditorDropdown configEditorAnnotation = optionField.getAnnotation(
ConfigEditorDropdown.class
);
- editor =
- new GuiOptionEditorDropdown(
- option,
- configEditorAnnotation.values(),
- 0,
- false
- );
+ editor = new GuiOptionEditorDropdown(option, configEditorAnnotation.values(), 0, false);
}
}
if (editor == null) {
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/util/GuiElementSlider.java b/src/main/java/com/thatgravyboat/skyblockhud/core/util/GuiElementSlider.java
index cdd745d..fd7d3b3 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/util/GuiElementSlider.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/util/GuiElementSlider.java
@@ -55,13 +55,8 @@ public class GuiElementSlider extends GuiElement {
@Override
public void render() {
- final ScaledResolution scaledResolution = new ScaledResolution(
- Minecraft.getMinecraft()
- );
- int mouseX =
- Mouse.getX() *
- scaledResolution.getScaledWidth() /
- Minecraft.getMinecraft().displayWidth;
+ final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ int mouseX = Mouse.getX() * scaledResolution.getScaledWidth() / Minecraft.getMinecraft().displayWidth;
float value = this.value;
if (clicked) {
@@ -70,47 +65,23 @@ public class GuiElementSlider extends GuiElement {
value = Math.round(value / minStep) * minStep;
}
- float sliderAmount = Math.max(
- 0,
- Math.min(1, (value - minValue) / (maxValue - minValue))
- );
+ float sliderAmount = Math.max(0, Math.min(1, (value - minValue) / (maxValue - minValue)));
int sliderAmountI = (int) (width * sliderAmount);
GlStateManager.color(1f, 1f, 1f, 1f);
Minecraft.getMinecraft().getTextureManager().bindTexture(slider_on_cap);
Utils.drawTexturedRect(x, y, 4, HEIGHT, GL11.GL_NEAREST);
- Minecraft
- .getMinecraft()
- .getTextureManager()
- .bindTexture(slider_off_cap);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(slider_off_cap);
Utils.drawTexturedRect(x + width - 4, y, 4, HEIGHT, GL11.GL_NEAREST);
if (sliderAmountI > 5) {
- Minecraft
- .getMinecraft()
- .getTextureManager()
- .bindTexture(slider_on_segment);
- Utils.drawTexturedRect(
- x + 4,
- y,
- sliderAmountI - 4,
- HEIGHT,
- GL11.GL_NEAREST
- );
+ Minecraft.getMinecraft().getTextureManager().bindTexture(slider_on_segment);
+ Utils.drawTexturedRect(x + 4, y, sliderAmountI - 4, HEIGHT, GL11.GL_NEAREST);
}
if (sliderAmountI < width - 5) {
- Minecraft
- .getMinecraft()
- .getTextureManager()
- .bindTexture(slider_off_segment);
- Utils.drawTexturedRect(
- x + sliderAmountI,
- y,
- width - 4 - sliderAmountI,
- HEIGHT,
- GL11.GL_NEAREST
- );
+ Minecraft.getMinecraft().getTextureManager().bindTexture(slider_off_segment);
+ Utils.drawTexturedRect(x + sliderAmountI, y, width - 4 - sliderAmountI, HEIGHT, GL11.GL_NEAREST);
}
for (int i = 1; i < 4; i++) {
@@ -118,31 +89,12 @@ public class GuiElementSlider extends GuiElement {
Minecraft
.getMinecraft()
.getTextureManager()
- .bindTexture(
- notchX > x + sliderAmountI
- ? slider_off_notch
- : slider_on_notch
- );
- Utils.drawTexturedRect(
- notchX,
- y + (HEIGHT - 4) / 2f,
- 2,
- 4,
- GL11.GL_NEAREST
- );
+ .bindTexture(notchX > x + sliderAmountI ? slider_off_notch : slider_on_notch);
+ Utils.drawTexturedRect(notchX, y + (HEIGHT - 4) / 2f, 2, 4, GL11.GL_NEAREST);
}
- Minecraft
- .getMinecraft()
- .getTextureManager()
- .bindTexture(slider_button_new);
- Utils.drawTexturedRect(
- x + sliderAmountI - 4,
- y,
- 8,
- HEIGHT,
- GL11.GL_NEAREST
- );
+ Minecraft.getMinecraft().getTextureManager().bindTexture(slider_button_new);
+ Utils.drawTexturedRect(x + sliderAmountI - 4, y, 8, HEIGHT, GL11.GL_NEAREST);
}
@Override
@@ -153,26 +105,17 @@ public class GuiElementSlider extends GuiElement {
if (Mouse.getEventButton() == 0) {
clicked =
- Mouse.getEventButtonState() &&
- mouseX > x &&
- mouseX < x + width &&
- mouseY > y &&
- mouseY < y + HEIGHT;
+ Mouse.getEventButtonState() && mouseX > x && mouseX < x + width && mouseY > y && mouseY < y + HEIGHT;
if (clicked) {
value = (mouseX - x) * (maxValue - minValue) / width + minValue;
value = Math.max(minValue, Math.min(maxValue, value));
- value =
- (float) (Math.round(value / minStep) * (double) minStep);
+ value = (float) (Math.round(value / minStep) * (double) minStep);
setCallback.accept(value);
return true;
}
}
- if (
- !Mouse.getEventButtonState() &&
- Mouse.getEventButton() == -1 &&
- clicked
- ) {
+ if (!Mouse.getEventButtonState() && Mouse.getEventButton() == -1 && clicked) {
value = (mouseX - x) * (maxValue - minValue) / width + minValue;
value = Math.max(minValue, Math.min(maxValue, value));
value = Math.round(value / minStep) * minStep;
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/util/MiscUtils.java b/src/main/java/com/thatgravyboat/skyblockhud/core/util/MiscUtils.java
index 4173694..5c59853 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/util/MiscUtils.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/util/MiscUtils.java
@@ -21,10 +21,7 @@ import org.lwjgl.input.Mouse;
public class MiscUtils {
public static void copyToClipboard(String str) {
- Toolkit
- .getDefaultToolkit()
- .getSystemClipboard()
- .setContents(new StringSelection(str), null);
+ Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(str), null);
}
private static void unzip(InputStream src, File dest) {
@@ -79,52 +76,28 @@ public class MiscUtils {
} catch (Exception ignored) {}
}
- public static void setCursor(
- ResourceLocation loc,
- int hotspotX,
- int hotspotY
- ) {
- if (
- currentCursor != null && loc.getResourcePath().equals(currentCursor)
- ) {
+ public static void setCursor(ResourceLocation loc, int hotspotX, int hotspotY) {
+ if (currentCursor != null && loc.getResourcePath().equals(currentCursor)) {
return;
}
currentCursor = loc.getResourcePath();
try {
BufferedImage image = ImageIO.read(
- Minecraft
- .getMinecraft()
- .getResourceManager()
- .getResource(loc)
- .getInputStream()
+ Minecraft.getMinecraft().getResourceManager().getResource(loc).getInputStream()
);
int maxSize = Cursor.getMaxCursorSize();
IntBuffer buffer = BufferUtils.createIntBuffer(maxSize * maxSize);
for (int i = 0; i < maxSize * maxSize; i++) {
int cursorX = i % maxSize;
int cursorY = i / maxSize;
- if (
- cursorX >= image.getWidth() || cursorY >= image.getHeight()
- ) {
+ if (cursorX >= image.getWidth() || cursorY >= image.getHeight()) {
buffer.put(0x00000000);
} else {
- buffer.put(
- image.getRGB(cursorX, image.getHeight() - 1 - cursorY)
- );
+ buffer.put(image.getRGB(cursorX, image.getHeight() - 1 - cursorY));
}
}
buffer.flip();
- Mouse.setNativeCursor(
- new Cursor(
- maxSize,
- maxSize,
- hotspotX,
- hotspotY,
- 1,
- buffer,
- null
- )
- );
+ Mouse.setNativeCursor(new Cursor(maxSize, maxSize, hotspotX, hotspotY, 1, buffer, null));
} catch (Exception e) {
e.printStackTrace();
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/util/StringUtils.java b/src/main/java/com/thatgravyboat/skyblockhud/core/util/StringUtils.java
index 48c7566..5b34cb1 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/util/StringUtils.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/util/StringUtils.java
@@ -7,10 +7,7 @@ import net.minecraft.client.gui.FontRenderer;
public class StringUtils {
- public static final Set<String> PROTOCOLS = Sets.newHashSet(
- "http",
- "https"
- );
+ public static final Set<String> PROTOCOLS = Sets.newHashSet("http", "https");
public static String cleanColour(String in) {
return in.replaceAll("(?i)\\u00A7.", "");
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/util/lerp/LerpUtils.java b/src/main/java/com/thatgravyboat/skyblockhud/core/util/lerp/LerpUtils.java
index b24bbe6..1b88f5a 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/util/lerp/LerpUtils.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/util/lerp/LerpUtils.java
@@ -11,10 +11,8 @@ public class LerpUtils {
}
private static final float sigmoidStr = 8;
- private static final float sigmoidA =
- -1 / (sigmoid(-0.5f * sigmoidStr) - sigmoid(0.5f * sigmoidStr));
- private static final float sigmoidB =
- sigmoidA * sigmoid(-0.5f * sigmoidStr);
+ private static final float sigmoidA = -1 / (sigmoid(-0.5f * sigmoidStr) - sigmoid(0.5f * sigmoidStr));
+ private static final float sigmoidB = sigmoidA * sigmoid(-0.5f * sigmoidStr);
public static float sigmoidZeroOne(float f) {
f = clampZeroOne(f);
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/util/lerp/LerpingFloat.java b/src/main/java/com/thatgravyboat/skyblockhud/core/util/lerp/LerpingFloat.java
index 9e379c7..edf129b 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/util/lerp/LerpingFloat.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/util/lerp/LerpingFloat.java
@@ -22,8 +22,7 @@ public class LerpingFloat {
int lastTimeSpent = timeSpent;
this.timeSpent += System.currentTimeMillis() - lastMillis;
- float lastDistPercentToTarget =
- lastTimeSpent / (float) timeToReachTarget;
+ float lastDistPercentToTarget = lastTimeSpent / (float) timeToReachTarget;
float distPercentToTarget = timeSpent / (float) timeToReachTarget;
float fac = (1 - lastDistPercentToTarget) / lastDistPercentToTarget;
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/util/lerp/LerpingInteger.java b/src/main/java/com/thatgravyboat/skyblockhud/core/util/lerp/LerpingInteger.java
index 63e7143..0bae869 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/util/lerp/LerpingInteger.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/util/lerp/LerpingInteger.java
@@ -22,8 +22,7 @@ public class LerpingInteger {
int lastTimeSpent = timeSpent;
this.timeSpent += System.currentTimeMillis() - lastMillis;
- float lastDistPercentToTarget =
- lastTimeSpent / (float) timeToReachTarget;
+ float lastDistPercentToTarget = lastTimeSpent / (float) timeToReachTarget;
float distPercentToTarget = timeSpent / (float) timeToReachTarget;
float fac = (1 - lastDistPercentToTarget) / lastDistPercentToTarget;
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/RenderUtils.java b/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/RenderUtils.java
index 242166b..518b928 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/RenderUtils.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/RenderUtils.java
@@ -14,28 +14,15 @@ import org.lwjgl.opengl.GL14;
public class RenderUtils {
- public static void drawFloatingRectDark(
- int x,
- int y,
- int width,
- int height
- ) {
+ public static void drawFloatingRectDark(int x, int y, int width, int height) {
drawFloatingRectDark(x, y, width, height, true);
}
- public static void drawFloatingRectDark(
- int x,
- int y,
- int width,
- int height,
- boolean shadow
- ) {
+ public static void drawFloatingRectDark(int x, int y, int width, int height, boolean shadow) {
int alpha = 0xf0000000;
if (OpenGlHelper.isFramebufferEnabled()) {
- ScaledResolution scaledResolution = new ScaledResolution(
- Minecraft.getMinecraft()
- );
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
BackgroundBlur.renderBlurredBackground(
15,
scaledResolution.getScaledWidth(),
@@ -59,20 +46,8 @@ public class RenderUtils {
Gui.drawRect(x + 1, y + height - 1, x + width - 1, y + height, dark); //Bottom
Gui.drawRect(x + 1, y + 1, x + width - 1, y + height - 1, main); //Middle
if (shadow) {
- Gui.drawRect(
- x + width,
- y + 2,
- x + width + 2,
- y + height + 2,
- 0x70000000
- ); //Right shadow
- Gui.drawRect(
- x + 2,
- y + height,
- x + width,
- y + height + 2,
- 0x70000000
- ); //Bottom shadow
+ Gui.drawRect(x + width, y + 2, x + width + 2, y + height + 2, 0x70000000); //Right shadow
+ Gui.drawRect(x + 2, y + height, x + width, y + height + 2, 0x70000000); //Bottom shadow
}
}
@@ -80,14 +55,7 @@ public class RenderUtils {
drawFloatingRectWithAlpha(x, y, width, height, 0xFF, true);
}
- public static void drawFloatingRectWithAlpha(
- int x,
- int y,
- int width,
- int height,
- int alpha,
- boolean shadow
- ) {
+ public static void drawFloatingRectWithAlpha(int x, int y, int width, int height, int alpha, boolean shadow) {
int main = (alpha << 24) | 0xc0c0c0;
int light = (alpha << 24) | 0xf0f0f0;
int dark = (alpha << 24) | 0x909090;
@@ -97,71 +65,29 @@ public class RenderUtils {
Gui.drawRect(x + 1, y + height - 1, x + width - 1, y + height, dark); //Bottom
Gui.drawRect(x + 1, y + 1, x + width - 1, y + height - 1, main); //Middle
if (shadow) {
- Gui.drawRect(
- x + width,
- y + 2,
- x + width + 2,
- y + height + 2,
- (alpha * 3 / 5) << 24
- ); //Right shadow
- Gui.drawRect(
- x + 2,
- y + height,
- x + width,
- y + height + 2,
- (alpha * 3 / 5) << 24
- ); //Bottom shadow
+ Gui.drawRect(x + width, y + 2, x + width + 2, y + height + 2, (alpha * 3 / 5) << 24); //Right shadow
+ Gui.drawRect(x + 2, y + height, x + width, y + height + 2, (alpha * 3 / 5) << 24); //Bottom shadow
}
}
- public static void drawTexturedModalRect(
- int x,
- int y,
- int textureX,
- int textureY,
- int width,
- int height
- ) {
+ public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height) {
double f = 0.00390625;
double f1 = 0.00390625;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
- worldrenderer
- .pos(x + 0.0, y + height, 0.0)
- .tex((textureX + 0.0) * f, (textureY + height) * f1)
- .endVertex();
- worldrenderer
- .pos(x + width, y + height, 0.0)
- .tex((textureX + width) * f, (textureY + height) * f1)
- .endVertex();
- worldrenderer
- .pos(x + width, y + 0.0, 0.0)
- .tex((textureX + width) * f, (textureY + 0.0) * f1)
- .endVertex();
- worldrenderer
- .pos(x + 0.0, y + 0.0, 0.0)
- .tex((textureX + 0.0) * f, (textureY + 0.0) * f1)
- .endVertex();
+ worldrenderer.pos(x + 0.0, y + height, 0.0).tex((textureX + 0.0) * f, (textureY + height) * f1).endVertex();
+ worldrenderer.pos(x + width, y + height, 0.0).tex((textureX + width) * f, (textureY + height) * f1).endVertex();
+ worldrenderer.pos(x + width, y + 0.0, 0.0).tex((textureX + width) * f, (textureY + 0.0) * f1).endVertex();
+ worldrenderer.pos(x + 0.0, y + 0.0, 0.0).tex((textureX + 0.0) * f, (textureY + 0.0) * f1).endVertex();
tessellator.draw();
}
- public static void drawTexturedRect(
- float x,
- float y,
- float width,
- float height
- ) {
+ public static void drawTexturedRect(float x, float y, float width, float height) {
drawTexturedRect(x, y, width, height, 0, 1, 0, 1);
}
- public static void drawTexturedRect(
- float x,
- float y,
- float width,
- float height,
- int filter
- ) {
+ public static void drawTexturedRect(float x, float y, float width, float height, int filter) {
drawTexturedRect(x, y, width, height, 0, 1, 0, 1, filter);
}
@@ -175,17 +101,7 @@ public class RenderUtils {
float vMin,
float vMax
) {
- drawTexturedRect(
- x,
- y,
- width,
- height,
- uMin,
- uMax,
- vMin,
- vMax,
- GL11.GL_NEAREST
- );
+ drawTexturedRect(x, y, width, height, uMin, uMax, vMin, vMax, GL11.GL_NEAREST);
}
public static void drawTexturedRect(
@@ -207,17 +123,7 @@ public class RenderUtils {
GL11.GL_ONE_MINUS_SRC_ALPHA
);
- drawTexturedRectNoBlend(
- x,
- y,
- width,
- height,
- uMin,
- uMax,
- vMin,
- vMax,
- filter
- );
+ drawTexturedRectNoBlend(x, y, width, height, uMin, uMax, vMin, vMax, filter);
GlStateManager.disableBlend();
}
@@ -235,39 +141,20 @@ public class RenderUtils {
) {
GlStateManager.enableTexture2D();
- GL11.glTexParameteri(
- GL11.GL_TEXTURE_2D,
- GL11.GL_TEXTURE_MIN_FILTER,
- filter
- );
- GL11.glTexParameteri(
- GL11.GL_TEXTURE_2D,
- GL11.GL_TEXTURE_MAG_FILTER,
- filter
- );
+ GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter);
+ GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, filter);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(x, y + height, 0.0D).tex(uMin, vMax).endVertex();
- worldrenderer
- .pos(x + width, y + height, 0.0D)
- .tex(uMax, vMax)
- .endVertex();
+ worldrenderer.pos(x + width, y + height, 0.0D).tex(uMax, vMax).endVertex();
worldrenderer.pos(x + width, y, 0.0D).tex(uMax, vMin).endVertex();
worldrenderer.pos(x, y, 0.0D).tex(uMin, vMin).endVertex();
tessellator.draw();
- GL11.glTexParameteri(
- GL11.GL_TEXTURE_2D,
- GL11.GL_TEXTURE_MIN_FILTER,
- GL11.GL_NEAREST
- );
- GL11.glTexParameteri(
- GL11.GL_TEXTURE_2D,
- GL11.GL_TEXTURE_MAG_FILTER,
- GL11.GL_NEAREST
- );
+ GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
+ GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
}
public static void drawGradientRect(
@@ -297,22 +184,10 @@ public class RenderUtils {
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
- worldrenderer
- .pos(right, top, zLevel)
- .color(startRed, startGreen, startBlue, startAlpha)
- .endVertex();
- worldrenderer
- .pos(left, top, zLevel)
- .color(startRed, startGreen, startBlue, startAlpha)
- .endVertex();
- worldrenderer
- .pos(left, bottom, zLevel)
- .color(endRed, endGreen, endBlue, endAlpha)
- .endVertex();
- worldrenderer
- .pos(right, bottom, zLevel)
- .color(endRed, endGreen, endBlue, endAlpha)
- .endVertex();
+ worldrenderer.pos(right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
+ worldrenderer.pos(left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
+ worldrenderer.pos(left, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex();
+ worldrenderer.pos(right, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex();
tessellator.draw();
GlStateManager.shadeModel(7424);
@@ -325,19 +200,7 @@ public class RenderUtils {
Gui.drawRect(left, top, left + width, top + height, 0x6008080E); //Middle
Gui.drawRect(left, top, left + 1, top + height, 0xff08080E); //Left
Gui.drawRect(left, top, left + width, top + 1, 0xff08080E); //Top
- Gui.drawRect(
- left + width - 1,
- top,
- left + width,
- top + height,
- 0xff28282E
- ); //Right
- Gui.drawRect(
- left,
- top + height - 1,
- left + width,
- top + height,
- 0xff28282E
- ); //Bottom
+ Gui.drawRect(left + width - 1, top, left + width, top + height, 0xff28282E); //Right
+ Gui.drawRect(left, top + height - 1, left + width, top + height, 0xff28282E); //Bottom
}
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/TextRenderUtils.java b/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/TextRenderUtils.java
index 4284012..478414e 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/TextRenderUtils.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/TextRenderUtils.java
@@ -32,14 +32,7 @@ public class TextRenderUtils {
return height;
}
- public static void drawStringVertical(
- String str,
- FontRenderer fr,
- float x,
- float y,
- boolean shadow,
- int colour
- ) {
+ public static void drawStringVertical(String str, FontRenderer fr, float x, float y, boolean shadow, int colour) {
String format = FontRenderer.getFormatFromString(str);
str = StringUtils.cleanColour(str);
for (int i = 0; i < str.length(); i++) {
@@ -47,13 +40,7 @@ public class TextRenderUtils {
int charHeight = getCharVertLen(c);
int charWidth = fr.getCharWidth(c);
- fr.drawString(
- format + c,
- x + (5 - charWidth) / 2f,
- y - 7 + charHeight,
- colour,
- shadow
- );
+ fr.drawString(format + c, x + (5 - charWidth) / 2f, y - 7 + charHeight, colour, shadow);
y += charHeight + 1.5f;
}
@@ -75,14 +62,7 @@ public class TextRenderUtils {
drawStringScaled(str, fr, x, y, shadow, colour, factor);
}
- public static void drawStringCentered(
- String str,
- FontRenderer fr,
- float x,
- float y,
- boolean shadow,
- int colour
- ) {
+ public static void drawStringCentered(String str, FontRenderer fr, float x, float y, boolean shadow, int colour) {
int strLen = fr.getStringWidth(str);
float x2 = x - strLen / 2f;
@@ -123,15 +103,7 @@ public class TextRenderUtils {
float fontHeight = 8 * factor;
- drawStringScaled(
- str,
- fr,
- x - newLen / 2,
- y - fontHeight / 2,
- shadow,
- colour,
- factor
- );
+ drawStringScaled(str, fr, x - newLen / 2, y - fontHeight / 2, shadow, colour, factor);
}
public static void renderToolTip(
@@ -156,15 +128,7 @@ public class TextRenderUtils {
}
FontRenderer font = stack.getItem().getFontRenderer(stack);
- drawHoveringText(
- list,
- mouseX,
- mouseY,
- screenWidth,
- screenHeight,
- -1,
- font == null ? fontStd : font
- );
+ drawHoveringText(list, mouseX, mouseY, screenWidth, screenHeight, -1, font == null ? fontStd : font);
}
public static void drawHoveringText(
@@ -217,10 +181,7 @@ public class TextRenderUtils {
List<String> wrappedTextLines = new ArrayList<String>();
for (int i = 0; i < textLines.size(); i++) {
String textLine = textLines.get(i);
- List<String> wrappedLine = font.listFormattedStringToWidth(
- textLine,
- tooltipTextWidth
- );
+ List<String> wrappedLine = font.listFormattedStringToWidth(textLine, tooltipTextWidth);
if (i == 0) {
titleLinesCount = wrappedLine.size();
}
@@ -305,10 +266,7 @@ public class TextRenderUtils {
backgroundColor
);
final int borderColorStart = 0x505000FF;
- final int borderColorEnd =
- (borderColorStart & 0xFEFEFE) >> 1 |
- borderColorStart &
- 0xFF000000;
+ final int borderColorEnd = (borderColorStart & 0xFEFEFE) >> 1 | borderColorStart & 0xFF000000;
RenderUtils.drawGradientRect(
zLevel,
tooltipX - 3,
@@ -346,18 +304,9 @@ public class TextRenderUtils {
borderColorEnd
);
- for (
- int lineNumber = 0;
- lineNumber < textLines.size();
- ++lineNumber
- ) {
+ for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) {
String line = textLines.get(lineNumber);
- font.drawStringWithShadow(
- line,
- (float) tooltipX,
- (float) tooltipY,
- -1
- );
+ font.drawStringWithShadow(line, (float) tooltipX, (float) tooltipY, -1);
if (lineNumber + 1 == titleLinesCount) {
tooltipY += 2;