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

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 20w07a, 20w08a, 20w09a, 20w10a, 20w12a, 20w13b, 20w14a, 20w15a, 20w16a, 20w17a, 20w18a, 20w19a, 20w20a, 20w20b, 20w21a
    • Fix Version/s: 20w22a
    • Labels:
      None
    • Confirmation Status:
      Confirmed
    • Category:
      Commands
    • Mojang Priority:
      Important

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                CHK: