Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-259832

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

XMLWordPrintable

    • Icon: Bug 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.

            Unassigned Unassigned
            OfekN OfekN
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              CHK: