If you hold a stick in your hand and perform this command:
/say @p[nbt={SelectedItem:{id:"minecraft:stick"}}]
it will say your name.
But if you use:
/data get entity @p SelectedItem
It claims that doesn't exist.
Linked issues
duplicates 1
Comments 2
In fact there is no tag SelectedItem
, only a compound SelectedItemSlot
[CHAT] Kumasasa has the following entity data: {HurtByTimestamp: 0, SleepTimer: 0s, Attributes: [{Base: 20.0d, Name: "generic.maxHealth"}, {Base: 0.0d, Name: "generic.knockbackResistance"}, {Base: 0.10000000149011612d, Name: "generic.movementSpeed"}, {Base: 0.0d, Name: "generic.armor"}, {Base: 0.0d, Name: "generic.armorToughness"}, {Base: 1.0d, Name: "generic.attackDamage"}, {Base: 4.0d, Name: "generic.attackSpeed"}, {Base: 0.0d, Name: "generic.luck"}], Invulnerable: 0b, FallFlying: 0b, PortalCooldown: 0, AbsorptionAmount: 0.0f, abilities: {invulnerable: 1b, mayfly: 1b, instabuild: 1b, walkSpeed: 0.1f, mayBuild: 1b, flying: 0b, flySpeed: 0.05f}, FallDistance: 0.0f, recipeBook: {recipes: [], isFilteringCraftable: 0b, toBeDisplayed: [], isFurnaceGuiOpen: 0b, isGuiOpen: 0b, isFurnaceFilteringCraftable: 0b}, DeathTime: 0s, XpSeed: 1845379364, XpTotal: 0, playerGameType: 1, seenCredits: 0b, Motion: [0.0d, -0.0784000015258789d, 0.0d], UUIDLeast: -6115592170309602880L, Health: 20.0f, foodSaturationLevel: 5.0f, Air: 300s, OnGround: 1b, Dimension: 0, Rotation: [-6.4614444f, 19.07557f], XpLevel: 0, Score: 0, UUIDMost: 2390402992847014660L, Sleeping: 0b, Pos: [41.49055273106857d, 64.0d, 49.156966317497925d], Fire: -20s, XpP: 0.0f, EnderItems: [], DataVersion: 1493, foodLevel: 20, foodExhaustionLevel: 0.0f, HurtTime: 0s, SelectedItemSlot: 0, Inventory: [{Slot: 0b, id: "minecraft:polished_granite", Count: 1b}], foodTickTimer: 0}
Don't know if bug or intended.
Please do not mark unreleased versions as affected.
You don't have access to them yet.