Mojira Archive
MC-259832

Combination of potion effect durations and amplifiers will cause a specific effect to disappear

The bug:

If you apply effects in a specific order, the game will be confused and it will think the effect had been expired even though you still have some time left with weaker amplifier.

How to reproduce:

run all of the following commands in order at the same tick:

effect give @p minecraft:haste 10 2
effect give @p minecraft:haste 20 1
effect give @p minecraft:haste 30 2
effect give @p minecraft:haste 50 0
 
the first 3 commands will cause a creation of an "empty" effect, and the last command adds the effect which will be removed.

internally the effects will be:

after 0s:
Amp 2, Dur 30s -> Amp 1, Dur 20s -> Amp 0, Dur 50s

after 29.5s:
Amp 2, Dur 0.05s -> Amp 1, Dur 0s -> Amp 0, Dur 20.05s

then after 30s the effect is removed.

Expected behavior:

expected that after 30s you will have an effect with Amplifier 0 and Duration 20s

How to solve the issue:

The only thing needed to be fixed is to turn a single if into a while:
instead of checking for a single hidden effect and applying it, it needs to continue checking until duration > 0 or until there are no more hidden effects.

Unresolved

OfekN

2023-02-08, 10:51 PM

2023-02-10, 08:11 AM

2

3

Confirmed

Low

Platform

Commands

23w06a

-