diff options
author | nea <nea@nea.moe> | 2023-07-23 15:52:37 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-07-23 15:52:46 +0200 |
commit | 162ab1f2af513e802f7cf1ccefb1c53d8bf62afd (patch) | |
tree | a8c55ce65e91c34cebac4902073ee3985c5c1c32 /src/main/java/com/thatgravyboat/skyblockhud/overlay | |
parent | c4fc3d5b4783a4f9cdc2079736880af55e26ca65 (diff) | |
download | SkyblockHud-Death-Defied-162ab1f2af513e802f7cf1ccefb1c53d8bf62afd.tar.gz SkyblockHud-Death-Defied-162ab1f2af513e802f7cf1ccefb1c53d8bf62afd.tar.bz2 SkyblockHud-Death-Defied-162ab1f2af513e802f7cf1ccefb1c53d8bf62afd.zip |
Add rift health manager
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/overlay')
-rw-r--r-- | src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java index 2a7cac9..d3a2f94 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java @@ -4,10 +4,9 @@ import com.mojang.realmsclient.gui.ChatFormatting; import com.thatgravyboat.skyblockhud.SkyblockHud; import com.thatgravyboat.skyblockhud.core.config.Position; import com.thatgravyboat.skyblockhud.handlers.HeldItemHandler; +import com.thatgravyboat.skyblockhud.location.RiftHandler; import com.thatgravyboat.skyblockhud.textures.Textures; import com.thatgravyboat.skyblockhud.utils.Utils; -import java.text.DecimalFormat; -import java.text.NumberFormat; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -15,10 +14,13 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import java.text.DecimalFormat; +import java.text.NumberFormat; + public class RPGHud extends Gui { private static int mana, maxMana, overflow = 0; - private static int health, maxHealth = 0; + private static float health, maxHealth = 0; // private static int dominus, maxDominus = 0; private static int defense = 0; @@ -31,7 +33,7 @@ public class RPGHud extends Gui { overflow = current; } - public static void updateHealth(int current, int max) { + public static void updateHealth(float current, float max) { health = current; maxHealth = max; } @@ -106,9 +108,15 @@ public class RPGHud extends Gui { drawTexturedModalRect(rightAligned ? x + 19 : 41 + x, 33 + y, rightAligned ? 196 : 0, 88, Utils.lerp(mc.thePlayer.getAir() / 300f, 0, 60), 4); } - Utils.drawStringScaled("" + mc.thePlayer.experienceLevel, font, (rightAligned ? 112 : 14) + x - (font.getStringWidth("" + mc.thePlayer.experienceLevel) / 2f), 34 + y, false, 8453920, 0.75f); - - Utils.drawStringScaled(ChatFormatting.RED + " \u2764 " + health + ChatFormatting.AQUA + " \u270E " + mana + ChatFormatting.GREEN + " \u2748 " + defense, font, (rightAligned ? 10 : 42) + x, 8 + y, true, 0xffffff, 0.75f); + Utils.drawStringScaled((RiftHandler.isInRift ? "" + (mc.thePlayer.experienceLevel / 60) + ":" + (mc.thePlayer.experienceLevel % 60) : "" + mc.thePlayer.experienceLevel), font, (rightAligned ? 112 : 14) + x - (font.getStringWidth("" + mc.thePlayer.experienceLevel) / 2f), 34 + y, false, 8453920, 0.75f); + int doubleHealth = (int) (health * 2); + String healthStr; + if (doubleHealth % 2 == 0) { + healthStr = "" + (doubleHealth / 2); + } else { + healthStr = "" + (doubleHealth / 2F); + } + Utils.drawStringScaled(ChatFormatting.RED + " ❤ " + healthStr + ChatFormatting.AQUA + " \u270E " + mana + ChatFormatting.GREEN + " \u2748 " + defense, font, (rightAligned ? 10 : 42) + x, 8 + y, true, 0xffffff, 0.75f); GlStateManager.color(255, 255, 255); GlStateManager.disableBlend(); |