-
Bug
-
Resolution: Unresolved
-
None
-
1.19.2
-
None
-
Confirmed
-
Commands
-
Normal
-
Platform
Somehow, data modify running a search on a container's Items list tag and not finding any matching elements in the list will delete any item in the container's Slot 0. This happens no matter whether items are in other slots, and only affects Slot 0; if slot 0 is empty, other slots are unaffected.
To reproduce:
1) Put down any container block (chest, shulker, barrel, dropper, furnace, etc) and put non-stone items in all slots.
2) Run
data modify block {X Y Z} Items[{id:"minecraft:stone"}].tag.Test set value 1b
3) Item in the container's Slot 0 will be gone.
Try again with at least one stone block in the container's inventory, and the item in Slot 0 will survive.
----------
Running this same test with a list in data storage rather than a block, what appears to be happening is that the command creates a new, matching entry in the list to operate on when none is found. In a container block's Items[] list, elements with no Slot tag are put in Slot 0, so this new entry replaces the existing entry in Slot 0, and then gets removed when the game tries to validate it because it doesn't have both an ID and Count.
This can be seen by running this command on an empty container, resulting in two Jack o'Lanterns being placed in Slot 0:
data modify block {X Y Z} Items[{id:"minecraft:jack_o_lantern"}].Count set value 2b