Skip to content

Commit 52377a6

Browse files
committed
text render fix
1 parent 8dc6c8a commit 52377a6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/main/java/com/falsepattern/lib/text/FormattedText.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,18 @@ public void drawWithShadow(FontRenderer renderer, int x, int y) {
251251
*/
252252
@SideOnly(Side.CLIENT)
253253
public void draw(FontRenderer renderer, int x, int y, boolean shadow) {
254-
x += renderer.drawString(text, x, y, colorMap.get(colorStyle).getRGB(), shadow);
255-
if (endLine)
254+
int startX = x;
255+
x = renderer.drawString(text, x, y, colorMap.get(colorStyle).getRGB(), shadow);
256+
if (endLine) {
256257
y += renderer.FONT_HEIGHT;
258+
x = startX;
259+
}
257260
for (val sibling: siblings) {
258-
x += renderer.drawString(sibling.text, x, y, colorMap.get(sibling.colorStyle).getRGB(), shadow);
261+
x = renderer.drawString(sibling.text, x, y, colorMap.get(sibling.colorStyle).getRGB(), shadow);
262+
if (sibling.endLine) {
263+
y += renderer.FONT_HEIGHT;
264+
x = startX;
265+
}
259266
}
260267
}
261268
}

0 commit comments

Comments
 (0)