diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-12-07 14:01:52 -0500 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-12-07 14:01:52 -0500 |
commit | 15255eb3e2379e950b39011bacecbdf6eb4441a7 (patch) | |
tree | 20aa030f964df84895861f004625e2d028ee97eb /src/main/java/me/Danker/utils | |
parent | 28f2c167e53e52f7c111e08652d1f4a906eab0f6 (diff) | |
download | SkyblockMod-15255eb3e2379e950b39011bacecbdf6eb4441a7.tar.gz SkyblockMod-15255eb3e2379e950b39011bacecbdf6eb4441a7.tar.bz2 SkyblockMod-15255eb3e2379e950b39011bacecbdf6eb4441a7.zip |
Add player and health to low health notification
Diffstat (limited to 'src/main/java/me/Danker/utils')
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index e0a7454..fbd8e4c 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -103,16 +103,21 @@ public class Utils { int height = scaledResolution.getScaledHeight(); int width = scaledResolution.getScaledWidth(); - int textLength = mc.fontRendererObj.getStringWidth(text); - - double scale = 4; - if (textLength * scale > (width * 0.9F)) { - scale = (width * 0.9F) / (float) textLength; + int drawHeight = 0; + String[] splitText = text.split("\n"); + for (String title : splitText) { + int textLength = mc.fontRendererObj.getStringWidth(title); + + double scale = 4; + if (textLength * scale > (width * 0.9F)) { + scale = (width * 0.9F) / (float) textLength; + } + + int titleX = (int) ((width / 2) - (textLength * scale / 2)); + int titleY = (int) ((height * 0.45) / scale) + (int) (drawHeight * scale); + new TextRenderer(mc, title, titleX, titleY, scale); + drawHeight += mc.fontRendererObj.FONT_HEIGHT; } - - int titleX = (int) ((width / 2) - (textLength * scale / 2)); - int titleY = (int) ((height * 0.45) / scale); - new TextRenderer(mc, text, titleX, titleY, scale); } public static void checkForSkyblock() { |