mojira.dev
MC-255736

"effects" condition of "effects_changed" advancement trigger checks all effects present after a change, instead of the effect that was added/removed

The Bug:

The behavior for the `effects_changed` advancement trigger is inconsistent when specifying an effect in the `effects` condition, and detects it upon ending via natural causes.

Observed:

In this example, I've used an advancement to detect the change of the invisibility effect (shown below) that links to a function that prints a message in chat. The message displays when I receive the effect (potion or command) and when I manually clear the effect (milk or command). The message does not display (aka effect change is not detected) when the effect runs out naturally.

If in the advancement trigger, no effect is specified, it will detect the effect changing no matter if it was given (potion or command), manually taken (milk or command), or naturally runs out.

Expected:

When an effect runs out, the `effects_changed` advancement trigger should detect it if it is specified in the `effects` condition, just like it does if no effect is specified.

Notes:

My guess is that when the effect is manually removed, the player is checked for what effects they have right before the effect is removed. But when the player naturally runs out of effects, the game checks right after the effect is removed, meaning the condition for the trigger is not valid.

The advancement used in my testing is printed below. An example datapack and video is attached as well.

{
  "criteria": {
    "requirement": {
      "trigger": "minecraft:effects_changed",
      "conditions": {
        "effects": {
          "minecraft:invisibility": {}
        }
      }
    }
  }
}

Attachments

Comments 5

Zip files are not allowed.

Um... yes they are... They just need to be in valid format, just like folders.

This issue is alerady mostly covered in MC-121429, I would suggest resolving this as a duplicate, and update the other to include this information seeing as it's already a fairly broad report.

I can confirm this, and I've attached a pack to reproduce. However, I have an extra observation:
The effects condition seems to not care which effects were changed, but which effects remain on the player. For example, if I apply invisibility, then night vision, then let night vision run out, the invisibility advancement triggers three times; though it was only changed once, it was present on me in all three events. This may be intended.

Thank you for your report!
After consideration, the issue is being closed as Working as Intended.

Please note, that mechanics of the game may change between updates.
Things such as graphics, sounds, world creation, biomes, redstone, villagers, and animals may not work the same in current versions.

Full Version HistorySnapshot Version HistoryThe official Minecraft feedback site

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

catter1

(Unassigned)

Confirmed

Data Packs

1.19.2, 1.20.4, 24w03b

Retrieved