mojira.dev
MC-295994

The `inventory_changed` advancement trigger doesn't trigger when a player drops an item

My advancement JSON file:

{
  "criteria": {
    "xclib:player/inventory_changed": {
      "trigger": "inventory_changed",
      "conditions": {
        "items": [
          {
            "predicates": {
              "custom_data": {
                "xclib:run_command": {
                  "inventory_change": {
                    "enable": true
                  }
                }
              }
            }
          }
        ]
      }
    }
  },
  "rewards": {
    "function": "xclib:player/trigger/inventory_changed"
  }
}

the rewards function file:

advancement revoke @s only xclib:player/inventory_changed

title @s[tag=debug] actionbar "背包变动"
playsound block.note_block.pling block @s ~ ~ ~ 1 2

Attachments

Comments 4

Give an item with following command:

/give @s minecraft:bow[minecraft:custom_data={'xclib:run_command':{inventory_change:{enable:true,command:"say 3"}}}]

and it triggered the advancement as well as you move it in player inventory. But when you throw it out, there will be no title and sound output.

Please attach a datapack that can be used to reproduce this issue

Can confirm in 1.21.11, datapack:

[media]

How to Reproduce:

  • Run the following command:

    /give @s minecraft:bow[minecraft:custom_data={'xclib:run_command':{inventory_change:{enable:true,command:"say 3"}}}]
  • Drop the given bow, observe how no title appears and no sound plays.



The previous attached datapack did not display the action bar/title, fixed datapack:

[media]




lbj

(Unassigned)

Confirmed

Platform

Normal

Data Packs

1.21.5, 26.1

Retrieved