Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

Is it possible to use /replace and give it a enchant without affecting the rest of the armor?

Writer Matthew Harrington

I'm trying to make it so that the command block gives you an elytra and you can't take it off since if you do so it will duplicate, is there a way to give the elytra an enchant of curse of binding and not effect the rest of the armor. I'm on bedrock edition btw.

1

1 Answer

Yes... and no (not really with the replace command)

/replaceitem entity <target> slot.armor.chest 0 elytra 1 0 {"minecraft:item_lock":{"mode":"lock_in_slot"}}

Let's just go over how this works, just in case you have to do something similar:

  • replaceitem entity: replace an item that an entity has
  • <target>: write who's items you want to replace. the player name or a target selector
  • slot.armor.chest: the armor slot where you equip chestplates and elytras
  • 0: this number doesn't matter in this case, but in cases such as when the slot is slot.inventory, this number tells the game which slot in your inventory
  • elytra: the item
  • 1 0: 1 elytra, and the 0 doesn't matter in this case, but the second number sometimes matters like when it is wool, it tells the color
  • {"minecraft:item_lock":{"mode":"lock_in_slot"}}: since there are no NBT tags in MCBE, we have item components. one of them is item lock, it locks the item into your inventory, and the lock_in_slot mode also locks it into that exact slot

I hope this helped!