0

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.

1

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?

-2

The command will have to start with something like /replaceitem

1
  • 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 at 8:38

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.