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
is duplicated by 6
relates to 1
Comments 9
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.
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.
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.
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:
(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.