How to reproduced (Video):
1. Place items inside the container (in this test I use water bottle)
2. run at least two /data modify command in the same tick
/data modify block <container> Items[{tag:{Potion:"minecraft:water"}}].tag set value {Value:"foo"}
/data modify block <container> Items[{tag:{Potion:"minecraft:water"}}].tag set value {Value:"bar"}
3. The item at Slot:0b will be removed even if the previous command returns nothing
What doesn't affect by this:
1. Items[index].tag work just fine
2. other commands such as /data get, etc.
Actual commands I use:
/data modify block ~-1 ~ ~ Items[{tag:{Potion:"minecraft:water"}}] set value {Value:"foo"}
/data modify block ~-1 ~-1 ~ Items[{tag:{Potion:"minecraft:water"}}] set value {Value:"bar"}
Linked issues
is duplicated by 1
Comments 3
The missing tag in the 3rd and 4th command is probably just my mistake when copying it over but ignoring that, your explanation is not correct.
The Slot NBT is not stored inside the {tag: {...
}} field so it cannot be removed even if the field was set by the /data
command and in those commands, nothing is being created, it simply modifies the NBT value that already exists in the container that it can find with the given predicate.
Though it has been far too long for me to remember what this bug report was about so if no one else has reported the same issue, it should be fine to close it.
The video has been removed, and you forgot
.tag
in the third and fourth commands.The commands don't need to run in the same tick.
The first command removes the Potion tag, so the second command finds no entry to modify.
Therefore, it creates a new entry at the end of the list.
At first, its value is
{tag:{Potion:"minecraft:water"
}}Then, it is set to
{tag:{Value:"bar"
}}The added entry does not contain
Slot
, so its value defaults to 0.It overwrites the other item with
Slot:0b
because the new entry is at the end of the list and therefore loaded after.The new item is missing
id
andCount
, so it is removed.