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

Duplicated use of criterion triggered simultaneously under an OR clause triggers advancement multiple times

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.21.4
    • None
    • Unconfirmed
    • Data Packs

      The bug

      Duplicated use of player_hurt_entity criterion that can be met simultaneously under an OR clause causes the advancement to trigger multiple times.

      How to reproduce

      1. Write an advancement that has multiple criterion triggered by a single action under an OR clause.
        "requirements":
        [
            [
                "player_attack_damage",
                "melee_damage",
                "player_attack_damage_2"
            ]
        ],
        
      2. Write a reward function that checks which criterion are met and revokes the advancement after achieved.
        execute as @s[advancements={test:monster_attack={player_attack_damage=true}}] run tellraw @a "player_attack_damage criteria triggered"
        execute as @s[advancements={test:monster_attack={player_attack_damage_2=true}}] run tellraw @a "player_attack_damage_2 criteria triggered"
        execute as @s[advancements={test:monster_attack={melee_damage=true}}] run tellraw @a "melee_damage criteria triggered"
        execute as @s[advancements={test:monster_attack=true}] run tellraw @a "Advancement triggered"
        advancement revoke @s only test:monster_attack
        
      3. Create a new world and load the datapack.
      4. Trigger the advancement by hitting a mob once.
      5. Check the result.
        Expected behaviour: The advancement is triggered only once, being able to check that all criterion are met at the same time in its reward function.
        Actual result: The advancement is triggered multiple times seperately, indicating that only one of the criterion listed is met each time.

      An example datapack and the result after following these steps with it are attached below.

        1. MC-279201.png
          MC-279201.png
          363 kB
        2. MC-279201.zip
          3 kB

            Unassigned Unassigned
            Tesserqct Tesserqct
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: