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 2Attachments
Comments 4
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.
Give an item with following command:
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.