aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWarnLowHealth.java3
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/fonts/DefaultFontRenderer.java6
2 files changed, 6 insertions, 3 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWarnLowHealth.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWarnLowHealth.java
index f3310ff3..c48b9046 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWarnLowHealth.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWarnLowHealth.java
@@ -34,6 +34,7 @@ import kr.syeyoung.dungeonsguide.mod.utils.TextUtils;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
@@ -80,7 +81,7 @@ public class FeatureWarnLowHealth extends TextHUDFeature {
String lowestHealthName = "";
int lowestHealth = 999999999;
Objective objective = ScoreboardManager.INSTANCE.getSidebarObjective();
-
+ if (objective == null) return Collections.emptyList();
for (Score sc : objective.getScores()) {
String line = sc.getVisibleName();
String stripped = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(line));
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/fonts/DefaultFontRenderer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/fonts/DefaultFontRenderer.java
index 85553740..935bf647 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/fonts/DefaultFontRenderer.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/richtext/fonts/DefaultFontRenderer.java
@@ -129,6 +129,7 @@ public class DefaultFontRenderer implements FontRenderer {
@Override
public double getWidth(char text, ITextStyle textStyle) {
double val;
+ if (text == '\n') return 0;
if (text == ' ') {
val = 4;
} else {
@@ -137,7 +138,7 @@ public class DefaultFontRenderer implements FontRenderer {
val = this.charWidth[i];
} else if (this.glyphData[text] != 0) {
int texStart = this.glyphData[text] >>> 4;
- int texEnd = this.glyphData[text] & 15 + 1;
+ int texEnd = (this.glyphData[text] & 15) + 1;
val = (texEnd - texStart) / 2.0 + 1;
} else {
val = 0;
@@ -217,6 +218,7 @@ public class DefaultFontRenderer implements FontRenderer {
private double renderChar(WorldRenderer worldRenderer, double x, double y, char ch, ITextStyle textStyle) {
+ if (ch == '\n') return 0;
if (ch == ' ') {
return 4.0F * textStyle.getSize() / 8.0;
} else {
@@ -286,7 +288,7 @@ public class DefaultFontRenderer implements FontRenderer {
int i = ch / 256;
bindTexture(worldRenderer, this.getUnicodePageLocation(i));
float xStart = (float)(this.glyphData[ch] >>> 4);
- float xEnd = (float)(this.glyphData[ch] & 15 + 1);
+ float xEnd = (float)((this.glyphData[ch] & 15) + 1);
float texX = (float)(ch % 16 * 16) + xStart;
float texY = (float)((ch & 255) / 16 * 16);