Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-117889

/clear command does not apply the [data] argument correctly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 1.16.210.59 Beta, 1.16.201 Hotfix
    • Fix Version/s: 1.16.220, 1.16.220.52 Beta
    • Labels:
      None
    • Confirmation Status:
      Confirmed
    • Platform:
      Multiple
    • ADO:
      471822

      Description

      Steps to reproduce

      1. /clear
      2. /give @p sapling 1 0
      3. /give @p sapling 1 1
      4. /clear @p sapling 1 1

      Expected result

      You end up with 1 oak sapling in your inventory.

      Actual result

      You end up with 1 spruce sapling in your inventory.

      Analysis

      The /clear command has to do 2 things:
      (1) Determine that the correct item is in the inventory.
      (2) Remove the correct item from the inventory.

      The bug here is that after it correctly performs (1) it ignores the [data] argument when doing (2) and removes the first matching item type that it finds. So, in the reproduction steps above,

      • If you skip step #3 then the command in step #4 will fail, because (1) works correctly.
      • If you run step #3 before step #2 then you will get the expected result and not see the bug, apparently because (2) checks inventory slots in order from first to last.
      • If you select the hotbar slot with the spruce sapling after step #3 (i.e. hold the item in the main hand) then you will get the expected result and not see the bug, apparently because (2) always begins with whatever hotbar slot is currently selected (i.e. with the item held in the main hand), then it proceeds through the hotbar and inventory slots.

      This bug is similar to issues with /clear that were reported in earlier versions but which I cannot reproduce in the current version: MCPE-86111 and MCPE-47378.

        Attachments

          Issue Links

            Activity

              People

              Reporter:
              GoldenHelmet [Mod] GoldenHelmet
              Votes:
              4 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                CHK: