mojira.dev
MC-179940

Player's attributes reset back to default values upon respawning

The Bug

When you modify your attributes and then die, all attributes reset back to the default values.

How to reproduce

  1. Change your max health attribute: /attribute @s generic.max_health base set 10

  2. Die in any way

  3. Respawn

  4. Check your max health: /attribute @s generic.max_health base get
    -> ❌ Max health is 20 it should be 10

Expected behavior

The base values aren't changed back to default values on respawning, but kept as they were. Modifiers are only lost if the effect/item that grants said modifier is lost.

Notes

This is potentially also the cause for MC-181604. Considering returning from the end is for most part just respawning.

Linked issues

MC-179831 Problem with the attribute command Resolved MC-179984 Respawning after modifying base max_health attribute leaves HP at 20 Resolved MC-180102 /Atrribute command bug Resolved MC-180128 attributes reseted after death or not applying Resolved MC-180147 command Resolved

Attachments

Comments 30

Confirmed

Affects version 20w18a.

Affects version 20w19a.

Christopher Lewis

A small work around involves setting up a scoreboard command and some redstone-related geeks (I have already set that in place in my Hogwarts map, I'll release it Wednesday.) It's kinda hard to explain, but you could try something like for one command block.

 

Just warning you, cheats need to be enabled if you don't have them already...

 

But for now, here are the steps:

 

Steps to workaround:

  1. Create scoreboard: /scoreboard objectives add deaths deathCount

  2. One command block set to repeating and always active - do /execute if entity @a[scores={death=1..} in one.

  3. Place a comparator with the subtract torch further away from the repeating command block. (Do this on three sides).

  4. Place an impulse needs-redstone command block with the attribute command to reset the attribute command.

  5. Place a second command block with immediate regeneration for a specified time, or perhaps instant health.

  6. For the unused comaprator, place a few repeaters all set to max (no less than five), and place a command block to reset the deathCount score.

Affects 1.16 Prerelease 1

20 more comments

Can confirm 1.20.1

Can confirm, 1.20.3 Release Candidate 1

Seeing as this report has not been updated by the creator since it's creation (and has only created 1 other report in the last couple years, no other activity), and needs to be modified (affects all attributes, as already stated back in 2020!), I'd like to request ownership of this report.

Confirmed in 24w09a / 24w10a.

I tried "/attribute @s minecraft:generic.scale base set .25" you are now the 1/4 the size of normal players.

Died and size returns to default after death. would like not to have to type this every single time a player dies.

Probably a controversial opinion given that this was reported as a bug, but I actually kinda like this? It's a lot easier having all the attributes be removed on death, since removing all attributes on death requires all their UUIDs/original bases, rather than just needing their values to restore them after the player respawns.

Jello

[Mod] turbo

Tommy Wallberg

Confirmed

Platform

Low

Commands

death, health

20w17a, 20w18a, 20w19a, 20w20b, 1.16 Release Candidate 1, ..., 23w51b, 24w07a, 24w09a, 1.20.5, 1.20.6

24w20a

Retrieved