mojira.dev
MC-19690

Reducing maxHealth / max_health can cause fake death

It's possible to have higher maximum health than actual health (see MC-16345) because the helth doesn't adequately update server-side when an attribute stops being applied.

In this state, when the player takes more damage than its max health, the client will show the death screen. However, since the maximum health has not actually been updated yet on the server side, the player doesn't die server-side. When the player then clicks "Respawn", the game continues as if the player hadn't died.

This is a client-server desync where on the client-side, the player dies, but server-side, it doesn't.

To reproduce

  1. Place a wither rose

  2. Switch into survival mode

  3. Give yourself this item:

    /give @p dirt{AttributeModifiers:[{AttributeName:"generic.max_health",Name:"generic.max_health",Amount:20d,Operation:0,UUID:[I;0,1,2,3],Slot:"mainhand"}]}
  4. Select the dirt block

  5. Run this command to fill your health:

    /effect give @p minecraft:instant_health 1 3
  6. Deselect the dirt block

  7. Walk into the wither rose
    → ❌ You die immediately (because the server sends to the client "decrease health by 20 because max health changed")
    → ❌ On the death screen, you continue to take damage

  8. Click "Respawn"
    → ❌ You don't respawn, but are still at the same location as if nothing happened

These actions can also cause this bug from being triggered, apart from being damaged by a wither rose:

  • Instant health effect

  • Instant damage effect

  • Poison effect

  • Suffocation

  • Drowning

  • Starvation (Hunger)

  • Hitting a wall with elytra

Linked issues

Attachments

Comments 49

Anon Ymus

Seems like a combination of MC-18027 and the issue where getting healed at the same time as you die causes you to turn sideways (which I can't seem to find).

Last Username

It's still happening in Minecraft 1.6.2. Check MC-29319 for simpler repro steps.

marcono1234

Confirmed for

  • 14w30c

  • 14w31a

  • Minecraft 1.8-pre 1

Form MC-33827:

  1. Give yourself an item with the max health attribute

    /give @p dirt 1 0 {AttributeModifiers:[0:{AttributeName:"generic.attackDamage",Name:"generic.attackDamage",Amount:10000,Operation:0,UUIDLeast:894654,UUIDMost:2872},1:{AttributeName:"generic.movementSpeed",Name:"generic.movementSpeed",Amount:2.5,Operation:1,UUIDLeast:111113,UUIDMost:1111},2:{AttributeName:"generic.maxHealth",Name:"generic.maxHealth",Amount:40,Operation:0,UUIDLeast:111113,UUIDMost:1111}],display:{Name:"GodSword 2.1",Lore:["The Ultimate Power","By Vengeur69"]}}
  2. Give yourself constantly the instant health effect by a clock or just use this command:

    /effect @p instant_health 300000 5
  3. Get hurt (this doesn't always work on the first try, the best way is to use this command; seems not to be necessary)

    /effect @p instant_damage 300000 1
  4. And now select and deselect the item with the max healt attribute very often

I know some of the steps here use other bugs, but this also works without using these bugs

Tan Chin Cheern

I am able to reproduce this, while healing with Regeneration, as I took damage, it showed I died, but my health is still full. And my health is still Regenerating. Once I hit the respawn button, I went all sideways (half dying animation). I'm playing on 1.8.1

TheMaxShaft

The more you do it, the lower the player gets

39 more comments
Avoma

Can confirm in 21w07a. Video attached.

mtmjnb

Can confirm in 21w11a 

but if modifying health with the /attribute command you have to specify your name (@s doesnt work)

Avoma

Can confirm in 21w17a.

Caledonite

I see this is "In Progress". Perhaps fix it and make it also a feature somehow?

Give me a new username

Fixed!

Daniel Goodman

Erik Broes

Confirmed

Normal

Player

animation, attribute, death-screen, interface, max_health

Minecraft 1.6.1, Minecraft 1.6.2, Minecraft 13w39b, Minecraft 14w20b, Minecraft 1.7.10, ..., 21w07a, 21w10a, 21w11a, 21w14a, 21w17a

1.17 Pre-release 1

Retrieved