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

"attribute max_health" command malfunctioning at low values

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.20.1
    • None
    • Windows 10, Java 18
    • Unconfirmed
    • (Unassigned)

      When a player's health is set to 1 with a repeating command block defined as always active, they will appear as having half a heart, but only once their health decreases, which makes some sense because the command decreases maximum health but leaves the actual health value untouched.

      However, when they respawn, it appears their health will be set back to 20 while still showing only half a heart being filled. The first bit of damage they take will have no effect, unless it is large enough to kill a player with 10 hearts on the spot (for example, a 24+ block fall). Taking damage a second time will kill the player as intended, and it appears that the first hit updates the player's health to the intended 1 half heart.

      What I expected to happen was:

      Upon respawning while the command block is active, the player's health value stays at 1, causing them to die in one hit regardless of damage amount.

      What actually happened was:

      Upon respawning, the player always requires two hits before dying, unless the first hit deals more than 20 damage.

       

      How to recreate:

      Create or open a world with cheats on.

      Get in Creative mode
      Place a repeating command block, containing the following command: /attribute @p minecraft:generic.max_health base set 1 . Check the "Always Active" box.

      Get in survival mode

      Take damage to update your health from 20 to 1 for the first time

      Die and respawn

      Take anywhere between 1 and 19 true damage

      Since the health bar only shows half a heart,, the player should die in one hit, but takes one extra with no visible change on the interface

            Unassigned Unassigned
            Tronche2Cake Tronche2Cake
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: