Steps to reproduce
Give yourself a single block of dirt.
/clear @s dirt 0 10
Expected result
The /clear command fails and does not remove any dirt because you do not have 10 dirt available to remove.
Observed result
The /clear command succeeds and removes your only dirt.
Doing "/clear @p [any item to clear] 0 10" will Clear the item to 10, it will remove it, now the problem is that when the item isn't the same as the command, its supposed to not work and not removing it, but no instead its removing the item when its on 9 only or 5 or 6 or 8, here's a clip of it (yes its on a command block)
Attachments
Comments 6
I think this is working as intended because the command completion suggestions label the quantity "maxCount". That implies that the number is a maximum, meaning the command will remove any count of items up to that number, or in other words it will remove at most that number of items.
Please link a video or other evidence showing your described behavior in an older version. To my knowledge the current behavior has always been the case in both editions.
Try using the hasitem selector, it should solve your issue
For example:
/clear @p[hasitem={item=dirt,quantity=10..}] dirt 0 10
Thank you for your report!
However, this issue has been closed as Working as Intended.
10 in this case is used for maximum amount of the item to be removed, not the minimum amount required in order to remove the item at all.
If you need help or have a suggestion you might like to follow a link below.
Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📓 Project Summary – 📧 Suggestions – 📖 Minecraft Wiki
Oh yeah, some youtubers also replying to their old videos doing the command block NPC shop for mcpe, saying "it does not work anymore" because of the update, I uploaded it here because if its a bug in Minecraft for centuries then how come no one reported it? So I uploaded here thinking its a Bug 🙂