Java 26.2
Attributes
Max Health
Base Set for @p
/attribute @p minecraft:max_health base set 40
Entity stats
Attributes are the underlying stats of every living entity. Java 1.21.2 dropped the generic. prefix from the attribute ids, so a command that works on one version silently targets nothing on the other. Pick the version and the generator writes an id your world accepts.
Double max health
/attribute @p minecraft:max_health base set 40base set 40 is twenty hearts; heal up afterwards -- raising the max does not fill it.
Faster movement
/attribute @p minecraft:movement_speed base set 0.2Default player speed is 0.1; 0.2 doubles it.
Knockback-immune boss
/attribute @e[type=zombie,limit=1,sort=nearest] minecraft:knockback_resistance base set 1knockback_resistance 1 shrugs off every hit -- a staple for arena bosses.
Java 1.21.2 dropped the generic. prefix from attribute ids: generic.max_health became max_health, generic.movement_speed became movement_speed. A command with the old prefix silently matches no attribute. Pick your version and the generator writes the right id.
Set the max_health attribute base value, then heal the entity (or set its Health) up to the new maximum. Raising max_health alone does not fill the extra hearts, which is why summoned bosses sometimes spawn at partial health.
base set/base add change the attribute directly and persist on that entity; a modifier is a named, stackable adjustment (add_value, add_multiplied_base, add_multiplied_total) that items and effects use. Use base for a permanent stat, a modifier for a temporary or gear-driven one.
Bedrock has no /attribute command; attributes there are set through entity NBT or components. The generator marks the command as Java Edition only.
Java 26.2
Base Set for @p
/attribute @p minecraft:max_health base set 40