mojira.dev
MCPE-172716

You can't detect an air item in "hasitem" on main hand, but you can replace your slot with air.

Fixing air to "hasitem" will resolve the problem.
1. Hold any item like DIRT on your main hand and do the "/replaceitem entity @p slot.weapon.mainhand 1 air" command;
2. It should replace your dirt slot with air or make it an empty slot.
3. But when you do the "/testfor @p [hasitem={item=air,location=slot.weapon.mainhand}]" command;
4. It won't detect you even if your main hand slot is empty or air.
5. Please resolve this issue as I believe there are a lot of players out there figuring out how to detect when a player does not have an item on their main hand.

Edit: Ignore the "\" next to the "[hasitem=" It's just a bug that keeps coming back whenever I remove it.

Linked issues

Attachments

Comments 0

No comments.

xDanielMC

(Unassigned)

Unconfirmed

Multiple

Windows 11

1.20.1 Hotfix

Retrieved