The bug
I wanted to use SelectedItem
tag for my built, but when used /data get entity KrolixWormix
, tag wasn't there.
Linked issues
is duplicated by
Attachments
Comments

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.
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
this tag is not actually saved, and a in-memory state of a combination of SelectedItemSlot and Inventory.
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
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.