Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-172272

/clear removes all items from crafting grid regardless of item type

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 20w22a
    • 20w07a, 20w08a, 20w09a, 20w10a, 20w12a, 20w13b, 20w14a, 20w15a, 20w16a, 20w17a, 20w18a, 20w19a, 20w20a, 20w20b, 20w21a
    • None
    • Confirmed
    • Commands
    • Important

      This was caused by the fix for MC-75328.

      How to reproduce

      1. Insert the following command in a repeating command block and power it
        clear @p diamond 
      2. Go into survival
      3. 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.

            mgatland [Mojang] Matthew Gatland
            Misoloo [Helper] Misode
            Votes:
            52 Vote for this issue
            Watchers:
            23 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: