mojira.dev
MC-121900

Player data output does not show SelectedItem and is invalid in a data path

The bug

I wanted to use SelectedItem tag for my built, but when used /data get entity KrolixWormix, tag wasn't there.

Linked issues

Attachments

Comments

user-f2760

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.

KrolixWormix

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.

user-f2760

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.

KrolixWormix

Oh, that how it works.. Thank you. But player has no SelectedItem. And SelectedItemSlot + Inventory not the same. Because SelectedItem was slot-independent

user-f2760

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.

KrolixWormix

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"

Pepijn96

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).

ScyllarusDactyl

Confirmed for 17w50a

ScyllarusDactyl

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).

JochCool

Can confirm for 18w01a

JochCool

Still the case in 18w03b

JochCool

Also the case in 18w05a and 18w07c.

JochCool

Still in 18w10d

Bluenade

i can unfortunately confirm this is still here even in 18w20c 😞

 

JochCool

Also in 18w21a

KrolixWormix

migrated

Confirmed

Minecraft 17w45b, Minecraft 17w50a, Minecraft 18w01a, Minecraft 18w03b, Minecraft 18w07c, Minecraft 18w10c, Minecraft 18w10d, Minecraft 18w11a, Minecraft 18w20c, Minecraft 18w21a

Minecraft 18w22a

Retrieved