184.108.40.206 Beta, 1.16.201 Hotfix
Steps to reproduce
- /give @p sapling 1 0
- /give @p sapling 1 1
- /clear @p sapling 1 1
You end up with 1 oak sapling in your inventory.
You end up with 1 spruce sapling in your inventory.
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.
- relates to
MCPE-47378 /clear [player] [identifier] does not behave correctly for blocks of data values above 0
MCPE-86111 The "/clear" command doesn't support data values