In 1.20.4 (and earlier), it was possible, to do right click detection of any block that has a right click action like so:
{
"criteria": {
"click_button": {
"trigger": "minecraft:item_used_on_block",
"conditions": {
"location": [
{
"condition": "minecraft:location_check",
"predicate": {
"block": {
"tag": "minecraft:buttons"
}
}
}
]
}
}
},
"rewards": {
"function": "test"
}
}
However, this no longer works in the current snapshot (note that you have to replace tag
with blocks
and prefix the block tag with a #
)
It looks like, the advancement now requires an item to be used.
Steps to reproduce:
Download the 1.20.5 datapack from the attachment
Use a dye or glow ink on a sign
-> ✔ You will see a chat message "Do not temper with the signs on my yard!"Right click any button
-> ❌ The advancement `buttons` does not triggerDownload the 1.20.4 version of the datapack (the only difference is the
blocks
field being changed totag
and the#
being removed, because of format changes)Repeat the steps above in 1.20.4
-> ✔ Pressing a button now prints "WHY ARE YOU PLAYING WITH MY BUTTONS?!"
Expected Behavior
minecraft:item_used_on_block
should work for any right click action on any block that has a right click action.
Observed Behavior
minecraft:item_used_on_block
only triggers when using an item on a block.
I believe this is WAI. You need to use the new
default_block_use
criterion. See also MC-269330 and MC-267456.