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
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.