mojira.dev
MC-130070

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

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.

Linked issues

Attachments

Comments 2

Not completely same with MC-108704, more likely a relative ticket.

Amplifiers over 127 get saved as negative due to the nature of NBT.

SnipUndercover

(Unassigned)

Unconfirmed

Minecraft 18w20c

Retrieved