The Bug
When you modify your attributes and then die, all attributes reset back to the default values.
How to reproduce
Change your max health attribute:
/attribute @s generic.max_health base set 10
Die in any way
Respawn
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
is duplicated by
relates to
Attachments
Comments


Affects version 20w18a.

Affects version 20w19a.

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:
Create scoreboard: /scoreboard objectives add deaths deathCount
One command block set to repeating and always active - do /execute if entity @a[scores={death=1..} in one.
Place a comparator with the subtract torch further away from the repeating command block. (Do this on three sides).
Place an impulse needs-redstone command block with the attribute command to reset the attribute command.
Place a second command block with immediate regeneration for a specified time, or perhaps instant health.
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

affects generic.attack_damage
(1.16 pre-4)

Affects 1.16 Release Candidate 1 and affects all attributes, not just max health.

also in 1.16.1
as above, this is for all attributes, not just health!

Attribute minecraft:generic.movement_speed also resets when relogging.

Shouldn't the Mojang Priority be set to important?

this is something Mojang decides
Can confirm in 20w51a.
Can confirm in 21w03a.
Can confirm in 21w06a.
Can confirm in 1.16.5 and 21w08b.
Can confirm in 21w15a.
Can confirm in 21w16a.

Confirmed in 1.17.

also they act really weird when coming back from the end... is it related to this ticket?
Can confirm in 1.17.1. @unknown, that issue is MC-181604.
Can confirm in 1.18.1.
Can confirm in 1.18.2.

Affects 22w19a.
Can confirm in 1.19.

Can confirm in 1.19.3 and when using "modifier add"

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.
Confirmed