Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-268106

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w19a
    • 1.20.4, 24w04a, 1.20.6
    • None
    • Confirmed
    • Entities
    • Normal
    • Platform

      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.

            Unassigned Unassigned
            clamlol [Helper] clam lol
            Votes:
            5 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: