Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-184261

consume_item trigger runs reward function before replacing the item

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • None
    • 1.15.2, 20w20b, 20w22a, 1.16 Pre-release 3
    • None
    • Unconfirmed
    • (Unassigned)

      The bug

      I expected to be able to replace the player's mainhand when the consume_item trigger runs. Instead the item gets replaced by what would've been the resulting item after consuming.

      How to reproduce

      1. Have an advancement that runs a function every time the player consumes an item
        {
          "criteria": {
            "requirement": {
              "trigger": "minecraft:consume_item"
            }
          },
          "rewards": {
            "function": "test:consume_item"
          }
        }
      2. Create a function that replaces the mainhand with an apple
        advancement revoke @s only test:consume_item
        replaceitem entity @s weapon.mainhand apple
      3. Take a stack of bread and eat it in survival
      4. You briefly see the item, but then it gets replaced by 63 bread

        1. food.mp4
          585 kB
          [Mod] tryashtar

            Unassigned Unassigned
            Misoloo [Helper] Misode
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: