The bug
The check to see if the player's hearts should shake only takes into account the actual health bar, not any health granted by the absorption status effect.
Steps to Reproduce by @unknown
Ensure you are in survival or adventure mode:
/gamemode survivalDisable natural regeneration:
/gamerule naturalRegeneration falseDamage yourself by running the following command three times:
/effect give @s instant_damage→ ✔ Your health bar begins to shake
Give yourself the absorption status effect:
/effect give @s absorption→ ❌ Your health bar continues to shake, despite your total health being greater than 4
Code analysis
Code analysis by @unknown can be found in this comment.
Attachments
Comments 16
imo wai, as absoprion can dissapear at any time. Absorption is like magic shield, when you are still injured.
Ensure you are in survival or adventure mode:
/gamemode survivalDisable natural regeneration:
/gamerule naturalRegeneration falseDamage yourself by running the following command three times:
/effect give @s instant_damage→ ✔ Your health bar begins to shake
Give yourself the absorption status effect:
/effect give @s absorption→ ❌ Your health bar continues to shake, despite your total health being greater than 4
I can confirm that this was an issue in 21w20a, however, I can no longer reproduce this in 1.17 Pre-release 1, meaning that this issue was fixed in this version.
Is that 1.17 Pre-release 1 or 1.17.1 Pre-release 1? Either way, can confirm that this issue is not present in 1.17.1 Pre-release 2.
The following is based on a decompiled version of Minecraft 1.12 using MCP 9.40pre-1. (Can confirm for 1.12.1)
In the method
net.minecraft.client.gui.GuiIngame.renderPlayerStats()there is a small piece of code which modifies the y-position of the player's hearts in the ingame GUI by a random integer between 0 and 2 every tick if the player's health falls below 4 (2 hearts). However, this does not include hearts added by the absorption effect. This issue can be fixed very easily by adding those hearts added by absorption to the if-statement (entityplayer.getAbsorptionAmount()).Suggested fix