I tried to figure it out and the only solution I could come up with was a command block for each slot. I'm currently making a one command where it will force armor on you but I want to make it so if you try to take it off it removes from your inventory.

  • as I understand, you need y command, wich is detecting the Item, wich you currently hold in your mouse, when it was in amour slot before ? – Radon8472 Apr 13 '17 at 8:41
  • Can they be wearing any type of armor? Or only one type, like iron? – Venya Jun 17 '17 at 16:10

There is no way to remove items if they are moved with the cursor, as far as I am aware, due to the fact that it doesn't have a slot id.

However clearing all other slots of a specific item and killing all dropped items is possible, using /replaceitem. This would require 36 command blocks to clear items from every slot in the inventory apart from armor, 37 if you include offhand.


/replaceitem entity @a slot.inventory.# minecraft:air

Replace # with a number from 0 to 26, with 0 being top-left slot and 26 being bottom right slot of the inventory. This does not include the hotbar


/replaceitem entity @a slot.hotbar.# minecraft:air

Replace # with a number from 0 to 8, 0 being far left hotbar slot, 8 being far right. This does not include offhand


/replaceitem entity @a slot.weapon.offhand minecraft:air

To clear the entire inventory, use /clear <player>

I know its a late answer, but this will work. It may cause a bit of lag. You will not be able to use any other items, unless you find a way of specifying what item to replace. I have tested /clear for its maxCount parameter, but it specifies the maximum amount to be cleared, not the maximum items left.

Good luck!


Maybe this will work: have 4 repeat, always active command blocks, each and every one having a /testfor command testing for all four armor pieces in your inventory, and then, right in front of those, conditional, chain, always active command blocks, that then remove the armor pieces.

  • That's the exact opposite of what OP wants, it's needlessly complicated and your answer isn't detailed enough. – Fabian Röling Jan 27 '18 at 10:49

Alternatively, you might be able to enchant the armor with the "Curse of Binding" making it impossible to remove in the first place.

  • This doesn't offer a solution to clear it with commands. – Fabian Röling Jan 27 '18 at 10:48
  • But it does solve the problem the asker wanted, because they want a way to force a player to wear armor without them being able to clutter up their inventory with armor. – RS_Mind Jan 29 '18 at 1:31
  • Then you should at least provide the commands to enchant it, because this is a Minecraft commands question. – Fabian Röling Jan 29 '18 at 7:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.