The bug
When I give myself extra max health with an attribute, then gain health, log out and log back in there are empty hearts but not the health.
Steps to Reproduce:
Give yourself a diamond sword that grants double health and hold it in your main hand.
/give @s diamond_sword[attribute_modifiers={modifiers:[{type:"generic.max_health",amount:20.0,slot:mainhand,id:"extra_max_hp_from_sword",operation:add_value}]}]
Give yourself some regeneration.
/effect give @s minecraft:regeneration 3 3 false
Take note of the health you currently have.
Reload into the world and once again, take note of the health that you now have.
Observed Behavior:
Additional health granted with items that have attributes is lost upon reloading the world.
Expected Behavior:
Additional health granted with items that have attributes would not be lost upon reloading the world.
Linked issues
is duplicated by 12
Attachments
Comments 30
@Dominik, Yes I meant 13w25a.
Also just confirmed with the 1.6 pre-release you don't even have to log out to lose the extra health. I gave myself the Health boost effect x 4, healed up and then the health just vanished and I was left with 10 empty hearts. Was in survival mode and the character body shuddered like I was taking damage but with not hurt sound. And that left me with an empty health boost.
I've just tested with the long regen potion. Every time the Health Boost Effect hits a 30 second mark the additional health is removed.
Oh and the health now remains after login, as long as it's within that 30 second window.
Can confirm this behavior in 21w39a. Here are some extra details regarding this problem.
The Bug:
Additional health granted with items that have attributes is lost upon reloading the world.
Steps to Reproduce:
Give yourself a diamond sword that grants double health and hold it in your main hand.
/give @s minecraft:diamond_sword{AttributeModifiers:[{AttributeName:"minecraft:generic.max_health",Amount:20,UUID:[I;1,2,3,4],Slot:"mainhand"}]}
Give yourself some regeneration.
/effect give @s minecraft:regeneration 3 3 false
Take note of the health you currently have.
Reload into the world and once again, take note of the health that you now have.
Observed Behavior:
Additional health granted with items that have attributes is lost upon reloading the world.
Expected Behavior:
Additional health granted with items that have attributes would not be lost upon reloading the world.
Can confirm for 23w33a.
(Approximate) expected behavior: On the first tick where a LivingEntity is being deserialized, don't run the check comparing health with LivingEntity.getMaxHealth() until the underlying field has been initialized to account for Attributes.
(Please. It's been 10 years.)
I can confirm this in 13w24b