Mojira Archive
MC-185546

"effects_changed" advancement trigger checks "player" predicate before an effect is given to or taken from the player

Background

The effects_changed advancement trigger should work after an effect is given to or taken from the player.

The bug

When using a player predicate in the advancement trigger to attempt to check if a certain effect is taken from the player, it is rather checked before the effect is taken away from them:

{
  "criteria": {
    "speed": {
      "trigger": "effects_changed",
      "conditions": {
        "player": [
          {
            "condition": "inverted",
            "term": {
              "condition": "entity_properties",
              "entity": "this",
              "predicate": {
                "effects": {
                  "speed": {}
                }
              }
            }
          }
        ]
      }
    }
  },
  "rewards": {
    "function": "game:effects_changed"
  }
}

How to reproduce

  1. Create an advancement such as the one shown above to check for a certain effect taken from the player.
  2. Create a reward function for the advancement:
    advancement revoke @s only game:give_speed
    say Hello!
    
  3. Use a Potion of Swiftness or /effect give @s speed to get the Speed effect.
  4. Use a Milk Bucket or /effect clear to clear the effect.
    The advancement is not granted and the message is not displayed.

Data pack

An attached data pack is provided below for easier reproduction.

Invalid

user-a4a49

2020-05-25, 04:42 AM

2020-05-27, 02:26 PM

2020-05-27, 02:26 PM

0

2

Unconfirmed

(Unassigned)

/effect, effect, effects, effects_changed, status-effect, status-effects

20w21a

-