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

Reloading the world causes potion effects that have an amplifier > 127 to get set to 0

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • Minecraft 18w20c
    • None
    • Unconfirmed

      The bug

      I noticed that after reloading the world, my resistance 255 effect wasn't working, in fact, after i checked, its amplifier reset to 0.

      Steps to reproduce

      1. Give yourself an effect which amplifier is greater than 127
      2. Reload the world
      3. Do /data get entity @s ActiveEffects
      4. Notice how the effect amplifier is 0

      Possible cause

      This might have to do something with how signed bytes work.
      Because we're entering unsigned bytes (0->255) in the /effect command as the amplifier, but the amplifier tag itself is a signed byte (-128->127), the game writes a negative value to the amplifier.
      So, 128 is -128, 200 is -56 and 255 is -1.
      However, when the game checks the amplifier, and sees the negative amplifier, it treats it as 0.

        1. image-2018-05-22-18-51-11-041.png
          679 kB
          SnipUndercover
        2. image-2018-05-22-18-52-08-049.png
          686 kB
          SnipUndercover
        3. image-2018-05-22-18-54-11-745.png
          685 kB
          SnipUndercover

            Unassigned Unassigned
            MxxHxx11 SnipUndercover
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: