mojira.dev
MC-148268

Using /data modify to edit the contents of a chest deletes the item on slot 0

When trying to  edit the contents of a chest and selecting a specific slot iside of Items[], on top of editing that slot, the contents of Items[0] will be removed.

As explained by Franco Caprile in the comments, the issue seems to be caused by the Slot tag being copied, overriding the index used to select what slot to put the info into.

Recreating the issue:

  1. Place a chest and fill its first three slots with items.

  2. Run

    /data modify block [x] [y] [z] Items[1] set value {anything_works_here:2711}

As you can see, this would delete the contents of slot 2 as expected, but ends up removing slot 1 in the process as well. Any other slots work properly as illustrated by slot 3.

Linked issues

Comments 2

this behavior happens presumably because of the deletion of the Slot tag, maybe it regenerates as Slot:0b and that's why the command affects it too. I don't think its a bug, its normal behavior.

@Franco Caprile After checking, this seems to be what's causing the issue. Still, I don't thin this should be considered intended behaviour, since you're specifying a position in the array, I think the slot tag shouldn't be copied. It makes sense because the slot is stored inside of the item in the array, but I don't find it useful in any case. If you're trying to copy an item from a slot in a chest to another one, it would be much more convenient if the Slot tag adjusted automatically, since that would allow to use the "searching by tag" (Items[{tag:{}}]) much more versatile.

I'll update the description of the issue with hat we found out.

Suso

(Unassigned)

Confirmed

container, data, modify

Minecraft 19w12b, Minecraft 19w13b, Minecraft 19w14a, Minecraft 19w14b, Minecraft 1.14 Pre-Release 2

Retrieved