-
Bug
-
Resolution: Unresolved
-
None
-
23w06a
-
None
-
Confirmed
-
Commands
-
Low
-
Platform
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.