mojira.dev
MC-92328

Testing for selected item doesn't work in off hand

This bug prevents you being able to use the selecteditem command while holding an item in your offhand. I get that you technically are selecting two items with one in your offhand, but it is a selected slot nonetheless.

Steps to re-create:
Repeat command block with /testfor @a {SelectedItem:{id:minecraft:stick}}
place a stick in your hotbar put it in your off-hand
it does not detect you selecting that item.

Comments 1

See MC-83992, the offhand slot number is -106b

So what you can do is:

/testfor @p {Inventory:[{id:"minecraft:stick",Slot:-106b}]}

SupahYayaz

michael

Unconfirmed

Minecraft 15w45a

Retrieved