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
Leave
hotbar.0empty and place one stone each inhotbar.1,hotbar.2, andhotbar.3.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 dirtRegardless of the contents of the inventory, this slot source selects the first two slots in
hotbar.*, namelyhotbar.0andhotbar.1. Remember these two slots for comparison.Again, leave
hotbar.0empty and place one stone each inhotbar.1,hotbar.2, andhotbar.3.Copy the slot source from the previous command into an
/item modifycommand, 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.