Java 26.2
Attributes
Max Health
Base Set for @p
/attribute @p minecraft:max_health base set 40
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.
Entity stats
Java 26.2
Base Set for @p
/attribute @p minecraft:max_health base set 40