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
- Give yourself an effect which amplifier is greater than 127
- Reload the world
- Do /data get entity @s ActiveEffects
- 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.
2018-05-22, 07:54 PM
2023-04-30, 09:47 AM
2018-05-22, 07:57 PM
0
3
-