-
Bug
-
Resolution: Fixed
-
Minecraft 1.12, Minecraft 1.12.1 Pre-Release 1, Minecraft 1.12.1, Minecraft 17w50a, Minecraft 1.13.2, Minecraft 19w04b, 1.16.4, 20w46a, 21w06a, 21w16a, 21w17a, 1.17, 1.17.1 Pre-release 2, 1.17.1, 21w44a, 1.18.1, 1.18.2, 1.19, 1.19.1 Pre-release 4, 1.19.2, 1.19.3, 23w03a, 1.19.4 Pre-release 2, 1.19.4, 1.20 Pre-release 6, 1.20.1, 1.20.4, 23w51b
-
Confirmed
-
Entities, Networking
-
Low
-
Platform
The bug
Effect amplifiers are read/written as byte (-128 to 127) from/to NBT instead of an integer (-2,147,483,648 to 2,147,483,647) which is how it is stored in memory. This causes a change is behavior when the effect is reloaded from NBT is the amplifier is above 127.
How to reproduce
- Give yourself jump boost with an amplifier higher than 127 using /effect
/effect give @s jump_boost 100 128
- Try to jump
→ You cannot jump (see alsoMC-90198) - Reopen the world
→ You now have jump boost with an amplifier of -128 when read (though will be considered 0 when an amplifier obtained via NBT is less than 0)
Code analysis
Based on 1.12 decompiled using MCP 9.40 PRE 1
The methods net.minecraft.potion.PotionEffect.readCustomPotionEffectFromNBT(NBTTagCompound) and net.minecraft.potion.PotionEffect.writeCustomPotionEffectToNBT(NBTTagCompound) reads/writes the amplifier as a byte, while it is stored in-memory as an integer.
- is duplicated by
-
MC-108980 jump boost 128 changes it's behavior after relogging
- Resolved
-
MC-112246 Potion levels higher than 127 do not work after relogging
- Resolved
-
MC-165572 Relogging while having an active potion effect will not trigger its effect
- Resolved
-
MC-206105 The jump boost effect does not work when its applied with commands and the particles are hidden
- Resolved
-
MC-208521 Resistance & Regeneration Status Effect
- Resolved
-
MC-262458 Custom potions spawned with commands do not apply effects correctly
- Resolved
-
MC-263866 Potions (splash, drinkable, and lingering) that should apply effects level 128 or greater apply the effects at level 0.
- Resolved
-
MC-264320 After exiting and re-entering the world, the resistance enhancement effect will be ineffective
- Resolved
-
MC-267773 Regeneration does not regenerate health quickly
- Resolved
- relates to
-
MC-10755 Effects with amplifiers over 4 (level V)/enchantments with level over max default value are not supported
- Resolved
-
MC-131290 Enchantments are saved as shorts, but are loaded as and function with integer values
- Resolved
-
MC-250079 Potions effects amplifier variable are int, but the packet uses byte
- Resolved