I am making a datapack that adds weight (slight movement speed penalty) to armor using attributes. I got it working for players using the command:

execute as @e[type=player,nbt={Inventory:[{Slot:100b}]},nbt=!{Inventory:[{Slot:100b,tag:{realistic:1}}]}] run item modify entity @s armor.feet minecraft:replace_boots

But I would like to also apply this to the armor worn by mobs. How do I test if a mob has any type of armor in a specific slot? Something to the effect of:

/execute as @e[nbt={ArmorItems:[{Slot:Chest}]}] run say hi

Otherwise, I have to have 24 commands (4 for each of the 6 tiers of armor).

  • Armor is a fine spelling in English. Armor = en-US; Armour = en-UK.
    – AdamRaichu
    Mar 8 at 12:34
  • Yea we dont use a U, also datapack is one word
    – Aceplante
    Mar 8 at 15:50
  • 1
    @Aceplante I would say that both the argument on the armour and the term of "data pack" are debatable (however the correct term is data pack, not datapack). In such cases, the asker's preference takes priority (unless asker is inactive). So in your case we're fine with however you want to format it, American English or British English are both fine and we'll accept an incorrect form of the term "data pack". As for my edit, it's a habit of mine. I always convert things to British English when I edit, because I'm Canadian. Mar 19 at 4:04

1 Answer 1


This can actually be done with a simple predicate:

  "condition": "minecraft:entity_properties",
  "entity": "this",
  "predicate": {
    "equipment": {
      "chest": {
        "count": {
          "min": 1

This predicate checks if the armour item in the chest slot has a count of 1 or more. Some may think to check for the item ID, but that is less likely to succeed. A count condition will always be able to differentiate between an item or no item.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .