diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-10-06 21:02:00 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-10-06 21:02:00 -0400 |
commit | 5d477d9d06933c7a52ea5df17160b89391387872 (patch) | |
tree | 4e76b9731e3e98a84d95fc7b6d8fbf5f65d22421 /src/main/java/me/Danker/handlers/TextRenderer.java | |
parent | a0ab465c3d39eac177f45d2b2f6903a27be3ba61 (diff) | |
download | SkyblockMod-5d477d9d06933c7a52ea5df17160b89391387872.tar.gz SkyblockMod-5d477d9d06933c7a52ea5df17160b89391387872.tar.bz2 SkyblockMod-5d477d9d06933c7a52ea5df17160b89391387872.zip |
Add ability to outline text in the style of SBA
Diffstat (limited to 'src/main/java/me/Danker/handlers/TextRenderer.java')
-rw-r--r-- | src/main/java/me/Danker/handlers/TextRenderer.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/me/Danker/handlers/TextRenderer.java b/src/main/java/me/Danker/handlers/TextRenderer.java index bf5711d..0e965e6 100644 --- a/src/main/java/me/Danker/handlers/TextRenderer.java +++ b/src/main/java/me/Danker/handlers/TextRenderer.java @@ -2,8 +2,10 @@ package me.Danker.handlers; import org.lwjgl.opengl.GL11; +import me.Danker.commands.ToggleCommand; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; +import net.minecraft.util.StringUtils; public class TextRenderer extends Gui { public TextRenderer(Minecraft mc, String text, int x, int y, double scale) { @@ -13,7 +15,16 @@ public class TextRenderer extends Gui { y -= mc.fontRendererObj.FONT_HEIGHT; for (String line : text.split("\n")) { y += mc.fontRendererObj.FONT_HEIGHT * scale; - drawString(mc.fontRendererObj, line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF); + if (ToggleCommand.outlineTextToggled) { + String noColorLine = StringUtils.stripControlCodes(line); + mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale) - 1, (int) Math.round(y / scale), 0x000000, false); + mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale) + 1, (int) Math.round(y / scale), 0x000000, false); + mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale), (int) Math.round(y / scale) - 1, 0x000000, false); + mc.fontRendererObj.drawString(noColorLine, (int) Math.round(x / scale), (int) Math.round(y / scale) + 1, 0x000000, false); + mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF, false); + } else { + mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF, true); + } } GL11.glScaled(scaleReset, scaleReset, scaleReset); } |