mojira.dev
MC-312967

Implicit empty-slot filtering in `/item modify` makes slot selection differ from all other commands

Slot sources used by /item modify appear to implicitly filter out empty slots, even when the slot source itself does not specify such a filter. This behavior can sometimes be useful, for example, by automatically optimizing operations that target all slots. However, when used with limit_slots slot sources, it causes /item modify to select different slots than all other commands using the same slot source. This seems problematic.

Steps to Reproduce

  1. Leave hotbar.0 empty and place one stone each in hotbar.1, hotbar.2, and hotbar.3.

  2. Run the following command and observe its behavior:

    /item fill entity @s {type:limit_slots,limit:2,slot_source:{type:slot_range,slots:"hotbar.*"}} with dirt

    Regardless of the contents of the inventory, this slot source selects the first two slots in hotbar.*, namely hotbar.0 and hotbar.1. Remember these two slots for comparison.

  3. Again, leave hotbar.0 empty and place one stone each in hotbar.1, hotbar.2, and hotbar.3.

  4. Copy the slot source from the previous command into an /item modify command, adapting the command to /item modify's syntax, then run it and observe its behavior:

    /item modify entity @s {type:limit_slots,limit:2,slot_source:{type:slot_range,slots:"hotbar.*"}} {type:set_item,item:dirt}

Expected Behavior

The command modifies hotbar.0 and hotbar.1, selecting the same slots as /item fill because both commands use the same slot source.

Actual Behavior

Unlike /item fill, the command modifies hotbar.1 and hotbar.2.


From what I could find, /item modify appears to be the only command that applies this implicit filter. Therefore, instead of comparing it with /item fill, you could also compare its behavior with slot sources used by other commands, such as /execute if items and /item ... from entity.

One additional point worth mentioning is that users can explicitly add a filter to the slot source definition if they want to filter out empty slots. This suggests that an implicit filter may not always be necessary.

Comments 0

No comments.

Triton365

(Unassigned)

Unconfirmed

26.3, 26.4 Snapshot 6

Retrieved