TransWikia.com

How to replace every specific item anywhere in my inventory with a specific item?

Arqade Asked by ImJunny on May 17, 2021

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

The command will have to start with something like /replaceitem

Answered by DEAN on May 17, 2021

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?

Answered by EvilSquirrelGuy on May 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP