Effect amplifier is read/written as byte from NBT despite being stored as an integer
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.
Linked Issues
is duplicated by9
relates to3
Created Issue:
Effect amplifier is read as signed byte from NBT despite being unsigned
The bug
Effect amplifiers are read as signed byte (-128 to 127) instead of as unsigned ones (0 to 255) from NBT.
How to reproduce
- Give yourself jump boost with an amplifier higher than 127
/effect @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 0Code analysis
Based on 1.12 decompiled using MCP 9.40 PRE 1
The method net.minecraft.potion.PotionEffect.readCustomPotionEffectFromNBT(NBTTagCompound) reads the amplifier as signed byte.
is duplicated by
relates to
The bug
Effect amplifiers are read as
signedbyte (-128 to 127) instead of asunsigned ones (0 to 255) from NBT.How to reproduce
- Give yourself jump boost with an amplifier higher than 127
/effect @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 of0Code analysis
Based on 1.12 decompiled using MCP 9.40 PRE 1
The method net.minecraft.potion.PotionEffect.readCustomPotionEffectFromNBT(NBTTagCompound) reads the amplifier as
signed byte.The bug
Effect amplifiers are read as byte (-128 to 127) instead of as an integer (-2,147,483,648 to 2,147,483,647) from NBT.
How to reproduce
- Give yourself jump boost with an amplifier higher than 127 using {{/effect
/effect @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.
Effect amplifier is readas signedbyte from NBT despite beingunsignedEffect amplifier is read/written as byte from NBT despite being stored as an integer
The bug
Effect amplifiers are read as byte (-128 to 127) instead of as an integer (-2,147,483,648 to 2,147,483,647) from NBT.
How to reproduce
- Give yourself jump boost with an amplifier higher than 127 using
{{/effect/effect @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.
The bug
Effect amplifiers are read as byte (-128 to 127) instead of as an integer (-2,147,483,648 to 2,147,483,647) from NBT.
How to reproduce
- Give yourself jump boost with an amplifier higher than 127 using /effect
/effect @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.
The bug
Effect amplifiers are read as byte (-128 to 127) instead of as an integer (-2,147,483,648 to 2,147,483,647) from NBT.
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
is duplicated by
is duplicated by
relates to
Confirmed for 1.19.2.
is duplicated by
relates to
is duplicated by
is duplicated by
The bug
Effect amplifiers are read as byte (-128 to 127) instead of
asan integer (-2,147,483,648 to 2,147,483,647)from NBT.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.
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
YOU KILLED THE CUSTOM MAP CREATORS
Hey there!
This looks to be a duplicate of MC-118857. Just to further inform you, this same idea affects all potion effects and not just resistance and regeneration. See the duplicated link for more details.
Hey there!
This report looks to be a duplicate of MC-118857, since you mentioned that you used an amplifier higher than 127.
MC-118857 then.
First part; what's the command you used?
Amplifier part: Duplicate of MC-118857.
Better link: MC-118857; it gets written to a byte turning it to -1, upon re-entering the world, the amplifier gets loaded as -1, and turns to 0 as negative amplifiers aren't allowed.
Duplicate of MC-118857.
Thank you for your report!
We're tracking this issue in MC-118857, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
– I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.
Negative amplifiers are read and treated as 0, this was a change mentioned in a change log years ago.
[~JingyBreadMan] amplifiers over 128 when saved overflow and become negative.
In any case, duplicate of MC-118857.
Can confirm for MC 1.12.1. I thought effects with a level over 4 aren't supported though?
Can confirm in 21w06a.
Can confirm in 21w16a.
Can confirm in 21w17a.
Can confirm in 1.17.
Confirm in 1.17.1 PRE1 and PRE2
Can confirm in 1.17.1.
Can confirm in 21w44a.
Can confirm in 1.18.1.
Can confirm in 1.18.2.
Can confirm in 1.19.2.
Confirmed for 1.19.2; interestingly, 1.19 changed the potion ID to use an int (string would've been better), but not the amplifier.
Affects haste as well, level 128 causes weird issues, haste won't apply unless you are using the correct tool
2023-02-16_21-59-23.mp4
This is a feature request.
How so? It literally causes a changing of behavior of effects on logging out and back in when the amplifier is over 127. While yes, it's an unsupported amplifier, this does make them extremely unreliable to use.
A highly similar issue with enchantment levels was deemed valid and fixed:
MC-131290.Marcono1234, seeing as you haven't touched this report since May 2022, would it be OK if I became the reporter? I'll keep this updated accordingly.
laser0383 please do not spam old issues with feedback. Please send this to the feedback site or discord server.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki