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

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 1.15.2, 20w20b, 20w22a, 1.16 Pre-release 3
    • Fix Version/s: None
    • Labels:
      None
    • Confirmation Status:
      Unconfirmed
    • Category:
      (Unassigned)

      Description

      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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated: