1

Since you can't modify player nbt data with /data modify, I had to think of a workaround.

I thought to use /data modify to copy a player's helmet into a chest, modify the item there, and replace it back on the player.

So, while wearing a helmet, I tried:

/data modify block 31 241 16 Items[] set from entity @p Inventory

Unfortunately, this doesn't copy over the players armor items, offhand, or 3rd inventory row. It only copies their hotbar and first 2 inventory rows.

Then, I tried:

/data modify block 31 241 16 Items set from entity @p Inventory[{Slot:103b}]

This didn't work. (By the way, slot 103 is the player's head slot) And to be sure:

/data modify block 31 241 16 Items[{Slot:0b}] set from entity @p Inventory[{Slot:103b}]

But no items appeared in the chest, even though I was wearing a helmet. However, this command works fine with item in my first hotbar slot:

/data modify block 31 241 16 Items[] set from entity @p Inventory[{Slot:0b}]

So I assume that /data modify just can't copy anything from a player's armor slots.

If that's the case, is there any way to modify a player's armor data?

7
  • This entire question is about modifying a block's data and then suddenly you ask how to edit player data? What? Commented Aug 18, 2019 at 5:31
  • 2
    @FabianRöling This person wants to modify the data of the helmet of some player, noticed that you can't easily change player NBT data and decided to copy the helmet into a chest... kinda... then modifying it in there. I'm not sure how you would make someone wear that particular helmet then, but I don't think that this question is unclear.
    – user232393
    Commented Aug 18, 2019 at 19:29
  • 1
    So the entire question comes down to "how to edit an item in a player inventory"? Commented Aug 19, 2019 at 7:57
  • @FabianRöling Yes. As far as I know though, that is impossible in vanilla minecraft currently.
    – Zach K
    Commented Sep 15, 2019 at 19:33
  • 3
    While this question is older, this one has the best answer. Therefore, I'm voting to close this one as a duplicate.
    – One 2 Many
    Commented Dec 18, 2020 at 17:53

0

Browse other questions tagged .