Unlike a normal /attribute command modifier or minecraft:health_boost status effect, minecraft:attributes enchantment effect for minecraft:max_health attribute does NOT maintain the player’s health value above 20 when they rejoin the world, meaning they have to spend saturation/food to regenerate the missing health they had before leaving the world.
Example enchantment test:extra_health:
{
"description": {
"translate": "HESOYAM"
},
"supported_items": "minecraft:leather_chestplate",
"weight": 1,
"max_level": 1,
"min_cost": {
"base": 0,
"per_level_above_first": 0
},
"max_cost": {
"base": 0,
"per_level_above_first": 0
},
"anvil_cost": 0,
"slots": [
"chest"
],
"effects": {
"minecraft:attributes": [
{
"attribute": "minecraft:max_health",
"id": "test:enchantment.extra_health",
"amount": 10,
"operation": "add_value"
}
]
}
}
This bug/inconsistency starts all the way from 1.21 and up.
See attached video for a demonstration.
Attached example data pack.
Thank you for helping us improve Minecraft! We saved your files: