mojira.dev
MC-310394

The player equipment.mainhand nbt data never exist

Step to reproduce :
- Hold any item in your main hand (minecraft:diamond in the example)
- Run the command : /data get entity @s equipment

Expected result :
”X has the following entity data: {mainhand: {id: "minecraft:diamond", count: 1}}”

Actual result :
”X has the following entity data: {}”

(The main hand item is not listed and the “mainhand” key does not exist)
Same behavior if the item has the component :

"minecraft:equippable": {
        "slot": "mainhand"
        }

It may be also due to this that the advancement trigger “inventory_changed” is not triggered when the player change his main hand.

Comments 2

Thank you for your report!
After consideration, the issue is being closed as Working as Intended.

/data get entity @s equipment gives back data of Equipped Equipment (from equipment slots)

/data get entity @s SelectedItem gives back data of item held in Mainhand

Please note, that mechanics of the game may change between updates.
Things such as graphics, sounds, world creation, biomes, redstone, villagers, and animals may not work the same in current versions.

Full Version History – Snapshot Version History – The official Minecraft feedback site

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

Can’t we, at least, have a copy of the “SelectedItem” data in the “equipment.mainhand” data if the item is equippable in mainhand :

"minecraft:equippable": {"slot": "mainhand"}

It would make the advancement trigger “inventory_changed” work as it should count as equipping the item.

RedWay

(Unassigned)

Unconfirmed

26.2

Retrieved