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

maxHealth modifiers using percentages do not add correctly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Awaiting Response
    • Affects Version/s: Minecraft 1.9.2
    • Fix Version/s: None
    • Environment:

      Windows 10, Java 8

    • Confirmation Status:
      Unconfirmed

      Description

      When multiple items with the attribute modifier maxHealth are equip in different slots and one of these items uses a flat + or - and the other uses percentages, the math and what transpires after does not seem to behave as intended.

      In the screenshots below, we have two items that add maxHealth modifiers to the player, a chestplate that when equip adds +20 max health (or another row of hearts) and then a diamond that when equip in the offhand, increases max health by 100%.

      When the chestplate is equip, another 10 hearts is added, as intended. Now, in theory, since the diamond adds 100% max health, we should have 4 rows of hearts, or 40 hearts, since the total after the chestplate is 20 hearts, and 100% of 20 is 20, so it should equal 40 hearts.

      Well, this does not happen. After the diamond is equip, there is no change at all, it remains at the same 20 hearts, or two rows. Interestingly enough, when the diamond is taken off, the max health goes back to 10 hearts, or one row, despite the chestplate remaining on. This is odd because you can easily add modifiers that increase it to 80 hearts if you so desire.

      Interestingly, this also happens in reverse; if the diamond is equip, 10 hearts is added, but if you try to equip the chestplate, which in theory should add another flat row of health, resulting in 30 hearts or 3 rows, but it does not, again nothing occurs. And if you remove the chestplate, your health goes back to 10 hearts despite the diamond being equip.

      Steps to Replicate
      1. Create an item adds a flat amount of maxHealth, say +20 hearts.
      2. Create another item that adds a percentage of maxHealth, say 100%.
      3. Equip both, one after the other.
      4. Witness.

      Thank you!

        Attachments

        1. 2016-05-09_18.04.39.png
          2016-05-09_18.04.39.png
          69 kB
        2. 2016-05-09_18.04.41.png
          2016-05-09_18.04.41.png
          70 kB
        3. 2016-05-09_18.04.52.png
          2016-05-09_18.04.52.png
          69 kB
        4. 2016-05-09_18.05.05.png
          2016-05-09_18.05.05.png
          73 kB
        5. 2016-05-09_18.05.11.png
          2016-05-09_18.05.11.png
          73 kB

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              EbonySky Josh Carney
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: