mojira.dev
MC-119183

Instant health potion kills player when health modifier brings health at or below 1E-46

The bug

In the simpler case, wearing armor that brings max health to 0 after modifiers causes a player to die when receiving the instant health potion effect, possibly detrimental to mapmakers. Example command given below:

/give @p diamond_helmet{AttributeModifiers:[{AttributeName:"generic.maxHealth",Name:"generic.maxHealth",Amount:-20,Operation:0,UUIDLeast:894653,UUIDMost:2871}]}

In fact, a health value of zero is not necessary for this to occur. A max health value as high as 1E-46 can lead to death. Commands for a relevant armor set given below:

/give @p diamond_helmet{AttributeModifiers:[{AttributeName:"generic.maxHealth",Name:"generic.maxHealth",Amount:-19.99999999999999,Operation:0,UUIDLeast:894654,UUIDMost:2872}]}
/give @p diamond_chestplate{AttributeModifiers:[{AttributeName:"generic.maxHealth",Name:"generic.maxHealth",Amount:-0.99999999999999,Operation:2,UUIDLeast:894655,UUIDMost:2873}]}
/give @p diamond_leggings{AttributeModifiers:[{AttributeName:"generic.maxHealth",Name:"generic.maxHealth",Amount:-0.99999999999999,Operation:2,UUIDLeast:894656,UUIDMost:2874}]}
/give @p diamond_boots{AttributeModifiers:[{AttributeName:"generic.maxHealth",Name:"generic.maxHealth",Amount:-0.9999,Operation:2,UUIDLeast:894657,UUIDMost:2875}]}

Removing the final trailing 9 from the last modifier brings the final max health up to 1E-45. The player will not die when drinking a health potion in this state.

Please note that this bug report refers to a server-side player death, not to be confused with "fake" client-side deaths which may also occur under similar conditions.

Comments 4

So, this is not a duplicate of MC-19690, but seemingly relates.

I would like to request ownership as the owner has been inactive since July of 2017.

I was unable to reproduce this issue in 22w03a. Is this still an issue?

I cannot reproduce this in 1.18.1. Might have been fixed with MC-19690

asanetargoss

(Unassigned)

Confirmed

(Unassigned)

Minecraft 1.12, Minecraft 1.12.2, Minecraft 18w22c, Minecraft 1.13.1

Retrieved