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

/clean an item crafted in the Crafting Table then /replaceitem to armor slot makes a ghost item


    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • None
    • 1.16.5, 21w05b
    • Windows 10 Professional (x64), Version 20H2, Simplified Chinese
      Build-in Java with Official Minecraft Launcher and Java 8 update 281 (1.8.0_281-b09) with third-party launcher
    • Unconfirmed
    • (Unassigned)

      I am building an adventure map using Command Blocks. I tried to detect if a player crafts an Iron Chestplate, then clear it and replace another one with nbts to armor slot.


      What I expect to happened:

      The Iron Chestplate removed from player's inventory, then another one with nbts appear in armor slot.

      What it actually happened:

      The Iron Chestplate removed from player's inventory, buy nothing appeared in armor slot.

      However, the Repeating Command Block with always active which I used to detect if a player crafts an Iron Chestplate showed an output saying "[11:06:22] Test passed, count: 1" and activates Redstone Comparator. The armor bar in adventure mode appears (See attachment "Armor bar appeared with ghost Iron Chestplate.png"). If I tried to clear items, it showed a message "Removed 1 items from player Leo204_LKY" though my inventory appears to be empty.

      How to reproduce:

      1. Give yourself a Command Block, a Repeating Command Block, a Chain Command Block and a Redstone Comparator.

      2. Place them like attachment "Command Block placement.png"

      3. Set the Command Blocks:

      • Repeating Command Block : Always Activate, Unconditional

        execute if entity @a[nbt={Inventory:[{id:"minecraft:iron_chestplate"}]

      • Impulse (Normal) Command Block: Needs Redstone, Unconditional

        clear @p minecraft:iron_chestplate

      • Chain Command Block: Always Activate, Unconditional

        replaceitem entity @p armor.chest minecraft:iron_chestplate

        (in 1.17) item entity @p armor.chest replace minecraft:iron_chestplate

      4. Give yourself 8 Iron Ingots (Or if you changed the item in the command, give exactly the amount of items to craft it), and make sure your inventory is empty except the items to craft (This one will be useful to test /clear later and not necessary).

      5. Craft an Iron Chestplate using crafting table, move it to your inventory.

      6. Open your inventory and check the chest armor slot.

      7. Set your own gamemode to adventure or survival, and check the armor bar.

      8. Run the command /clear in chat.


      The armor will appear if you try to damage its durability by hurting yourself. But if you replace it with another chestplate manually, it disappears forever.

      This also happens when trying to replace player's offhand. However shield will not activate and block attacks.

      I have tried moving an Iron Chestplate from a chest to my inventory using the same command above, the bug also happens.

      However, try replacing an item to hotbar or inventory that is visible in furnance or chest's GUI, the item will appear normally.

      Sorry for my bad English.

            Unassigned Unassigned
            Leo204_LKY Leo Li
            0 Vote for this issue
            0 Start watching this issue