mojira.dev
MC-268106

Entities' current health is not capped at their max health in all applicable situations

There are several situations where the game does not check whether an entity's current health exceeds its maximum health even though it would make sense to do so. Fixing this would solve several existing issues and pre-empt many more. Below is a table of the applicable situations:

Event
Health capped
Notes

Take damage

By far the situation with the greatest impact on gameplay. Causes MC-195931 and the gameplay effects of MC-16345 and MC-267968.

Spawn

Tracked in MC-93833. Causes MC-178383 and MC-267968. A fix would contravene the WAI on MC-32575. The best solution would be to go against that WAI and initialize active_effects, Attributes, and Health in that order.

Unload/reload

 

Max health modified

Sometimes

Tracked in MC-16345.

Heal

Sometimes

It seems that there's no overarching heal method (or if there is, it isn't universally used), and the implementation is instead left to the effect in question. For this reason, the instant health effect will cap the value when applied to a full-health entity while the regeneration effect will not.

Fixing this issue would make spawner NBT and /summon commands a bit nicer, since the spawned entity would be at full health if the Health field were omitted. A fix would also raise the question of whether this same logic should extend to similar issues (eg. should mobs spawned with a large scale attribute also move faster by default?) but that can be tackled another day.

Comments 0

No comments.

clamlol

(Unassigned)

Confirmed

Platform

Normal

Entities

1.20.4, 24w04a, 1.20.6

24w19a

Retrieved