-
Bug
-
Resolution: Fixed
-
Minecraft 15w41b, Minecraft 15w45a, Minecraft 15w46a, Minecraft 15w47c, Minecraft 1.9.2, Minecraft 16w36a, Minecraft 1.11, Minecraft 1.12, Minecraft 1.12.2, Minecraft 18w05a, Minecraft 1.13, Minecraft 1.13.1-pre1, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w43b, Minecraft 18w45a, Minecraft 18w46a, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w49a, Minecraft 19w04b, Minecraft 19w07a, Minecraft 19w12b, Minecraft 19w13b, Minecraft 19w14a, Minecraft 19w14b, Minecraft 1.14.3
-
Confirmed
-
(Unassigned)
The bug
Applying the same effect you already have but with an amplifier higher than 127 causes the timer to reach 0:00 and remain like this but you still have the potion effect.
How to reproduce
- Type the command
/effect give @s minecraft:strength 10
- Before the timer of the effect reaches 0:00, type the command
/effect give @s minecraft:strength 30 128
→ The effect's timer should remain at 0:00, but you would still have the effect
Code analysis
The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.
This is a valid report because the method net.minecraft.client.network.NetHandlerPlayClient.handleEntityEffect(SPacketEntityEffect) is not reading the amplifier correctly. The packet stores the amplifier as unsigned byte (0 to 255), however the client reads it as signed byte (-128 to 127). Because of this the client thinks the amplifier is lower and does not extend the duration of the effect. The effect remains however as the client does not receive a SPacketRemoveEntityEffect packet, because for the server, the potion duration was extended.
public void handleEntityEffect(SPacketEntityEffect packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId()); if (entity instanceof EntityLivingBase) { Potion potion = Potion.getPotionById(packetIn.getEffectId()); if (potion != null) { // Replaced this //PotionEffect potioneffect = new PotionEffect(potion, packetIn.getDuration(), packetIn.getAmplifier(), packetIn.func_186984_g(), packetIn.func_179707_f()); PotionEffect potioneffect = new PotionEffect(potion, packetIn.getDuration(), Byte.toUnsignedInt(packetIn.getAmplifier()), packetIn.func_186984_g(), packetIn.func_179707_f()); potioneffect.setPotionDurationMax(packetIn.func_149429_c()); ((EntityLivingBase)entity).addPotionEffect(potioneffect); } } }
- relates to
-
MC-10755 Effects with amplifiers over 4 (level V)/enchantments with level over max default value are not supported
- Resolved