Player data output does not show SelectedItem and is invalid in a data path
Created Issue:
Player has no SelectedItem NBT tag
I wanted to use SelectedItem tag for my built, but when used /data get entity KrolixWormix, tag wasn't there
Changed Summary:
Playerhas noSelectedItemNBT tagPlayer data output does not show SelectedItem
Added Attachments:
Removed Attachments:
Added Affects Versions: 17w50a
Added Affects Versions: 18w03b
Changed Description:
Added Affects Versions: 18w07c
Added Affects Versions: 18w11a
Added Linked Issues:
is duplicated by
Added Assignee:
[Mojang] Nathan Adams
Changed Summary:
Player data output does not show SelectedItem and is invalid in a data path
Added Linked Issues:
is duplicated by
Added Affects Versions: 18w20c
Added Fixed Versions: 18w22a
The bug
Player data has been confirmed as something that should not be modifiable (see for example MC-120693). Yet this you can use /execute store to modify parts of it.
I'm personally not against this, it's useful and I think it's restricted to a "safe" area. This report is more to get an answer on "is this intended or not?".
Affected tags
Affected is the tag NBT key for items inside a player's Inventory key, EnderItems or SelectedItem (not a saved tag, but see MC-121900) key.
How to reproduce
- Run
/give @s stick{Test:1b} - Make sure the stick is in the most left slot in your hotbar
- Run
/execute store result entity @s Inventory[0].tag.Test byte 5 run data get entity @s Pos[0]
- Run
/data get entity @s Inventory[0].tag.Test
→ The Test tag indeed has the 5 times the X position of the player when the second command was ran as its value

Does the tag still function though?
I'm asking because this tag is not actually saved, and a in-memory state of a combination of SelectedItemSlot and Inventory.
It was useful on other versions( still functions on 17w43a/b). On 17w45a/b you also can't detect any non-integer player NBT tag.
Not true:
execute if entity @a[nbt={SelectedItem:{id:"minecraft:bow"}}]It still works fine, as I said, it's an in-memory tag only, and as such is not printed in the output.
I'm leaving it open though, just so the devs will consider to print it regardless.
Oh, that how it works.. Thank you. But player has no SelectedItem. And SelectedItemSlot + Inventory not the same. Because SelectedItem was slot-independent
Read my message again
I'm not saying it's the same, I'm saying that that in-memory tag is created by looking at the selected item slot, getting the data from the inventory in the same slot, and remove the slot tag.
Also i tried that, but nothing happened
/execute if entity @a[nbt={SelectedItem:{id:"glass_bottle"}}] run say hello
P.S. and I released your message too late )
UPD: Id must be "minecraft:glass_bottle"
It being in-memory only also prevents SelectedItem from being usable in any NBT path:
"/data get entity @p SelectedItem.Count" will always fail (because there's no saved compound named SelectedItem).
Confirmed for 17w50a
Being able to use "/data get entity @p SelectedItem.<something> would be very useful for map making!
It allows to read (custom) values inside items in a easy way, which is very useful when used with '/execute store'.
For example, making ender_pearls that have a teleport to a custom location (SelectedItem.tag.teleport.x), or adding upgradeable stats to fake weapons (SelectedItem.tag.level).
Can confirm for 18w01a
Still the case in 18w03b
Also the case in 18w05a and 18w07c.
Still in 18w10d
i can unfortunately confirm this is still here even in 18w20c
Also in 18w21a