diff options
| author | la <76826837+3UR@users.noreply.github.com> | 2026-03-10 13:30:01 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-09 22:30:01 -0500 |
| commit | d7596aa28c0ff7773e5a64155e54f2821517c591 (patch) | |
| tree | f5527871cf71d2856e57e3a7ae6d3d82303f180a | |
| parent | c998346312c753fa4359804c2c1823e23bce5b91 (diff) | |
Fix issue where visually the HUD shows you have 0 hearts when you dont (#1089)
* Fix for issue where player is able to stay alive with zero hearts in their healthbar.
* use static cast over c style cast
| -rw-r--r-- | Minecraft.Client/Common/UI/IUIScene_HUD.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Minecraft.Client/Common/UI/IUIScene_HUD.cpp b/Minecraft.Client/Common/UI/IUIScene_HUD.cpp index fd977966..d2754789 100644 --- a/Minecraft.Client/Common/UI/IUIScene_HUD.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_HUD.cpp @@ -195,8 +195,8 @@ void IUIScene_HUD::renderPlayerHealth() // Update health bool blink = pMinecraft->localplayers[iPad]->invulnerableTime / 3 % 2 == 1; if (pMinecraft->localplayers[iPad]->invulnerableTime < 10) blink = false; - int currentHealth = pMinecraft->localplayers[iPad]->getHealth(); - int oldHealth = pMinecraft->localplayers[iPad]->lastHealth; + int currentHealth = static_cast<int>(ceil(pMinecraft->localplayers[iPad]->getHealth())); + int oldHealth = static_cast<int>(ceil(pMinecraft->localplayers[iPad]->lastHealth)); bool bHasPoison = pMinecraft->localplayers[iPad]->hasEffect(MobEffect::poison); bool bHasWither = pMinecraft->localplayers[iPad]->hasEffect(MobEffect::wither); AttributeInstance *maxHealthAttribute = pMinecraft->localplayers[iPad]->getAttribute(SharedMonsterAttributes::MAX_HEALTH); |
