mojira.dev
MC-123307

'/execute store' can modify player data inside item "tags" of their Inventory or EnderItems

The bug

Player data has been confirmed as something that should not be modifiable (see for example MC-120693). Yet this you can use /execute store to modify parts of it.

I'm personally not against this, it's useful and I think it's restricted to a "safe" area. This report is more to get an answer on "is this intended or not?".

Affected tags

Affected is the tag NBT key for items inside a player's Inventory key, EnderItems or SelectedItem (not a saved tag, but see MC-121900) key.

How to reproduce

  1. Run

    /give @s stick{Test:1b}
  2. Make sure the stick is in the most left slot in your hotbar

  3. Run

    /execute store result entity @s Inventory[0].tag.Test byte 5 run data get entity @s Pos[0]
  4. Run

    /data get entity @s Inventory[0].tag.Test

    → The Test tag indeed has the 5 times the X position of the player when the second command was ran as its value

Linked issues

Comments

migrated

Suggestion for a fix:
Limit it to non-player entities and add

execute store <success|result> item <(block <x> <y> <z>)|(entity <selector>)> <slot> <path> <data-type> <scale> ...

instead.

CreeperMagnet_

Affects 1.13-pre6. I agree with @unknown's suggestion, adding a

/execute store <success|result> item

command would work lots better. It would also be nice to have

/data merge item
migrated

Confirmed for 1.13.1.

migrated

Confirmed for 18w43a.
Interestingly, /data modify does not allow targeting the tag tag in player inventories

marcono1234

I'm personally not against this, it's useful and I think it's restricted to a "safe" area. This report is more to get an answer on "is this intended or not?".

The problem with this is, if I remember it correctly, that there is no guarantee that the client is informed in time about the change. Therefore, if the tag entry effects how the client can use the item, or how it is displayed, then the client may experience a desync.

migrated

1.14 Confirmed

Change the nbt in SeletecItem or Inventory unless the tag exist dosen't work.

migrated

Personally I find this functionality very useful and had up until now been considering it a feature. I would love to see it receive more support or possibly receive a more officially supported and feature complete way to edit player NBT, there are so many cool things that can be done with the ability to modify player data. And sadly execute store is still quite limited and specific another example

SolidBlock

I suggest that the whole player data should be changeable by commands.

vdvman1

Dinnerbone has previously explained why they can't, and won't do that. TLDR; modifying NBT actually involves destroying and recreating the entity/block, and doing so for players would kick them from the server

migrated

It's interesting that you would say, "It can't be done without kicking the players from the server", cause I can confirm that data is being stored inside of Item tags so clearly it's not impossible...

vdvman1

That's only because the `tag` tag of items is different to most NBT, it is stored as actual NBT in memory, whereas other things such as `Pos` and `Motion` are not, they are stored in a different internal format

SolidBlock

confirmed in 1.14.2, but maybe not five times of x pos.

[media]

FaRo1

@unknown What do you mean? This report has nothing to do with your X position. Also, that image is broken.

MukiTanuki

I’m really quite disappointed this bug was fixed with no alternative. Currently there are no other ways to modify item nbt inside player inventories, and as it stands a couple dozen of my own datapacks are now broken and completely unfixable.

migrated

Boq has stated there'll likely get an alternative after the feature freeze, go check out the r/minecraftcommands discord server, where it was said.

migrated

Well that's disappointing. This was very useful in coding data packs

violine1101

This is a bug tracker, and not a discussion forum. If you want to discuss this change, please head over to somewhere else.

FaRo1

Specifically, here: https://www.reddit.com/r/Mojira/

That is the intended place for discussions about Minecraft bugs and the bugtracker.

FaRo1

@unknown Can you link that reference, please?

Pepijn96

boq

Confirmed

Commands

/execute, /execute-store, player, player-data

Minecraft 17w50a, Minecraft 18w02a, Minecraft 18w03a, Minecraft 18w03b, Minecraft 18w05a, ..., Minecraft 1.13, Minecraft 18w31a, Minecraft 1.13.1, Minecraft 18w43a, Minecraft 1.14

19w37a

Retrieved