Skip to content

Fix issue where visually the HUD shows you have 0 hearts when you dont#1089

Merged
codeHusky merged 2 commits intosmartcmd:mainfrom
3UR:main
Mar 10, 2026
Merged

Fix issue where visually the HUD shows you have 0 hearts when you dont#1089
codeHusky merged 2 commits intosmartcmd:mainfrom
3UR:main

Conversation

@3UR
Copy link
Contributor

@3UR 3UR commented Mar 10, 2026

Description

This is something 4J Studios fixed in TU20 (https://minecraft.fandom.com/wiki/Xbox_360_Edition_TU20)
image

4J also used ceil() in TU20 so this code is the exact same changes they made
image

Changes

Previous Behavior

HUD would display you have 0 hearts when you have a half of a heart.

Root Cause

The game was casting the float to a int which truncated the decimal.

New Behavior

HUD will now show half of a heart instead of none.

Fix Implementation

Use ceil() to prevent the decimal being truncated.

AI Use Disclosure

No AI was used.

Related Issues

@codeHusky
Copy link
Collaborator

should use the modern style casts in-line with the rest of the project (static_cast and whatnot)

@codeHusky codeHusky merged commit d7596aa into smartcmd:main Mar 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 0 hearts and still alive

2 participants