mojira.dev
MCPE-155675

Hasitem filter allows ‘air’ to be inputted as an item but filter cannot detect it

The hasitem filter requires an item. It displays a syntax error when the item is invalid. However, ‘air’ is valid to input but filter cannot detect an entity with ‘air’ (no targets found). /replaceitem allows ‘air’ as a valid input so why doesn’t the hasitem filter do the same?

Linked issues

Comments 9

Your report does not contain enough information to fully understand or reproduce the problem.
Please include a numbered list of steps along with the Observed and Expected results by Editing the Description above as shown here:

Steps to Reproduce:
1. (list every step and command exactly, so someone else can reproduce the issue, and try following your list to make sure you can still reproduce the issue yourself)
2.
3.
Observed Results:
(briefly describe what actually happens, including exact message(s) shown)
Expected Results:
(briefly describe what should happen)

(add screenshots or video to help explain the issue)

This report has been temporarily closed as Awaiting Response. It will automatically reopen when you add information. Please follow the format shown and include all sections (steps, observed, expected). Reports that do not contain all of the requested information and complete steps to reproduce the issue may be closed as Incomplete. For more information please read the Bug Tracker Guidelines.

You may find this Report Creation Form helpful for any future reports you create.

Hello, I'm experiencing the same issue, here is more information about it :

Steps to Reproduce:

  • Open chat to write the following command : /execute @s[hasitem={item=air,location=slot.weapon.mainhand}] ~~~ /say TEST

-Execute the command

Observed Results:
"No targets matched selector", Even if our main hand or any other slot in our inventory we want to test is empty it will never execute the /say command.

Expected Results:
When the slot is empty the command should run when we test if there's air.

Still Affecting 1.19.60

Workaround:

execute as @a at @s unless @s[hasitem={item=<item>,location=<slotid>}] run <command>

Hello, I am experiencing the same issue.

 

Steps to Reproduce:

1. Hold any item like DIRT on your main hand and do the "/replaceitem entity @p slot.weapon.mainhand 1 air" command; It should replace your dirt slot with air or make it an empty slot.

2. But when you do the "/testfor @p [hasitem={item=air,location=slot.weapon.mainhand}]" command; It won't detect you even if your main hand slot is empty or air.

 

Observed Results:

"No targets matched selector", even if your main hand or any other slot in your inventory you want to test is empty or air.

Expected Results:

When the main hand slot is empty or air, the command should detect you as having an empty slot or air slot on the main hand.

 

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

This issue is going on.
Steps to Reproduce was opened by xDanielMC 2 months ago and this way is correct.
I hope the problem will be solved soon.

Still affecting 1.20.51

Please only comment if you have new information related to reproducing this issue.
Repetitive or unhelpful comments may be deleted or edited to reduce clutter.
The best way you can indicate that an issue is important to you is to vote for it.
The Mojira Discord should be used to add new affected Versions.
For more information please see the Bug Tracker Guidelines.

Still affecting 1.20.61

GhostlyBlaze21

(Unassigned)

876073

Confirmed

Multiple

1.18.30, 1.18.31, 1.19.11 Hotfix, 1.19.20, 1.19.60, ..., 1.20.41 Hotfix, 1.20.51 Hotfix, 1.20.60, 1.20.73 Hotfix, 1.21.51 Hotfix

Retrieved