This was caused by the fix for MC-75328.
How to reproduce
Insert the following command in a repeating command block and power it
clear @p diamondGo into survival
Get any other item in your inventory and move it into the crafting slots
❌ The item gets cleared even though it is not a diamond
Code analysis
The reason for this is that the method net.minecraft.server.commands.ClearInventoryCommand#clearInventory(CommandSourceStack, Collection, Predicate, int) simply calls InventoryMenu#clearCraftingContent() without making use of the ItemPredicateArgument or the maxCount properties.
Linked issues
is duplicated by 21
relates to 1
Comments 16
also happening in snapshot 20w13b … whether multiple items (eg 53 bones) or non stackable item (fishing rod)
@Derek Wu You are supposed to be able to supply a specific item for it to clear. The issue is that it will clear all items in the crafting grid, regardless of the paramater.
@Derek Wu Like Penguin _Spy said. It's especially an issue with datapacks, many of which are broken because they run /clear minecraft:specific_item, but instead clear everything and might render players wholly unable to use the 2x2 crafting grid.
This is even worse than it first seems, because using
clearwith amaxCountof 0 is how maps/datapacks check how many of an item a player has.With this bug causing
maxCountto be ignored, checking how many items a player has will instantly delete the items they're crafting with.