-
Bug
-
Resolution: Invalid
-
None
-
Minecraft 18w15a, Minecraft 18w20c, Minecraft 1.13-pre4, Minecraft 1.13-pre6, Minecraft 1.14 Pre-Release 1, Minecraft 1.14, Minecraft 1.14.3 Pre-Release 3, 19w39a
-
None
-
Confirmed
-
(Unassigned)
The problem
Instead of an empty NBT tag or {Slot:0}, there is no NBT for empty slots in inventories. That means that commands like /data get entity @s Inventory[5] don't print the content of the sixth inventory slot, but instead the content of the sixth filled inventory slot.
This makes it incredibly complicated to get the item in a specific slot, because you would have to first check every slot if it's filled, then use different commands depending on the output.
Also it's inconsistent with HandItems and ArmorItems.
Also affects any other inventory, not just the player.
Something to consider: data remove should probably not move every item over one slot.
Possible solutions
Have inventory entries for empty slots
Use an empty compound or one which only contains the Slot tag to fill empty slots.
Use a map instead of a list
Use a map instead of a list for storing inventories, with slots numbers as keys and the respective item stacks as values.
Advantages
- Does not require empty compounds for empty slots
- "Saner" because Slot tag is not actually part of item stack NBT data and therefore should not be written to it
Disadvantages
- Currently prevents easily "moving" items in inventories by changing their Slot value