aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/hud/interfaces/TextHud.java
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-04 14:53:10 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-04 14:53:10 +0200
commitddca3a3232eff15a7130efda03e7e5c408554412 (patch)
treeef7678412590ca432bb2cd25aabfc3bf2ea4b7b0 /src/main/java/io/polyfrost/oneconfig/hud/interfaces/TextHud.java
parent1210e38c2ff569a28b20d7d0182557fbf386d524 (diff)
parent2696141f9790fd6c8d3df1148f46d298512c4902 (diff)
downloadOneConfig-ddca3a3232eff15a7130efda03e7e5c408554412.tar.gz
OneConfig-ddca3a3232eff15a7130efda03e7e5c408554412.tar.bz2
OneConfig-ddca3a3232eff15a7130efda03e7e5c408554412.zip
merge
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/hud/interfaces/TextHud.java')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/hud/interfaces/TextHud.java16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/hud/interfaces/TextHud.java b/src/main/java/io/polyfrost/oneconfig/hud/interfaces/TextHud.java
index 33bbd79..3c9cf4c 100644
--- a/src/main/java/io/polyfrost/oneconfig/hud/interfaces/TextHud.java
+++ b/src/main/java/io/polyfrost/oneconfig/hud/interfaces/TextHud.java
@@ -14,10 +14,10 @@ public class TextHud extends BasicHud {
*/
private final FontRenderer fb = Minecraft.getMinecraft().fontRendererObj;
boolean shadow = false;
+ boolean doExample = false;
private List<String> cachedLines;
private int cachedWidth;
private int cachedHeight;
- boolean doExample = false;
private List<String> cachedExampleLines;
private int cachedExampleWidth;
private int cachedExampleHeight;
@@ -35,8 +35,7 @@ public class TextHud extends BasicHud {
cachedWidth = 0;
for (String line : cachedLines) {
int width = fb.getStringWidth(line);
- if (width > cachedWidth)
- cachedWidth = width;
+ if (width > cachedWidth) cachedWidth = width;
}
}
if (doExample) {
@@ -46,8 +45,7 @@ public class TextHud extends BasicHud {
cachedExampleWidth = 0;
for (String line : cachedExampleLines) {
int width = fb.getStringWidth(line);
- if (width > cachedExampleWidth)
- cachedExampleWidth = width;
+ if (width > cachedExampleWidth) cachedExampleWidth = width;
}
}
}
@@ -59,20 +57,18 @@ public class TextHud extends BasicHud {
@Override
public void draw(int x, int y, float scale) {
- if (cachedLines != null)
- drawText(cachedLines, x, y, scale);
+ if (cachedLines != null) drawText(cachedLines, x, y, scale);
}
@Override
public void drawExample(int x, int y, float scale) {
doExample = true;
- if (cachedExampleLines != null)
- drawText(cachedExampleLines, x, y, scale);
+ if (cachedExampleLines != null) drawText(cachedExampleLines, x, y, scale);
}
private void drawText(List<String> lines, int x, int y, float scale) {
for (int i = 0; i < lines.size(); i++) {
- Renderer.drawTextScale(lines.get(i), x, y + i * 12, 0xffffff, shadow, scale);
+ Renderer.drawScaledString(lines.get(i), x, y + i * 12, 0xffffff, shadow, scale);
}
}