Mojira Archive
MC-184263

item_used_on_block trigger has no way to check the original block

The bug

Unlike what the trigger name suggest, you can't detect what the original block was for the item_used_on_block trigger. The location condition is evaluated after the block change was made. This makes it impossible to detect some actions.

How to reproduce

  1. Create the following advancement.
    {
      "criteria": {
        "place": {
          "trigger": "minecraft:item_used_on_block",
          "conditions": {
            "location": {
              "block": {
                "block": "minecraft:dirt"
              }
            }
          }
        }
      },
      "rewards": {
        "function": "test:tilled_dirt"
      }
    }
  2. Create the following function
    advancement revoke @s only test:tilled_dirt
    say used item on dirt
  3. Use a hoe on dirt
    Notice that the advancement is not granted
  4. This advancement will be granted correctly when placing block on dirt, because the dirt itself does not change
  5. This can also be verified by checking the state of button presses.

Fix

An easy way to fix this is by adding a "block" predicate to this trigger. Triggers like bee_nest_destroyed can already check the original block.

Invalid

[Helper] Misode

2020-05-17, 01:46 PM

2024-05-28, 02:25 PM

2020-05-29, 10:26 AM

14

10

Confirmed

(Unassigned)

20w20b, 20w21a

-