I am trying to make a datapack for weighted armors by replacing all normal armors with ones with specific attributes. I understand how attributes work, but I can't seem to find a way to replace normal ones correctly. I tried to modify nbt data of items in your inventory, but it appears impossible to do.

2 Answers 2


I'm not sure if it's possible to replace armour anywhere in a player's inventory, but you would be able to replace the armour if a player equips it using the execute command

execute as @a[nbt={Inventory:[{Slot: 102b,id:"minecraft:netherite_chestplate",Count:1b}]}] run replaceitem entity @s armor.chest netherite_chestplate{NBT}

This command would replace a netherite chestplate in the chestplate slot of a player with a chestplate with modified NBT data (I assume you're using this for attributes, if so, just replace the "NBT" placeholder with the actual NBT data)

Command found here: Can you /testfor a specific inventory slot?


The command will have to start with something like /replaceitem

  • Hi Dean, this is only part of an answer, and seemingly uncertain at that. Can you expand on it? If not, please refrain from answering until you have a complete answer.
    – Joachim
    Mar 1, 2021 at 8:38

You must log in to answer this question.

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