The bug
When attempting to test for empty equipment using the "has_equipment" filter, the IDs "air"
and an empty string (""
) both fail. This leaves no way to test if the hand is empty through filters, short of negating a filter testing every single item in the game.
Steps to reproduce:
The supplied behavior pack modifies the player's behavior to include an additional trigger; it tests to see if the player is sneaking, and if they are either holding air or an empty string (""
).
Create a new world with Holiday Creator Features enabled (or use an existing one).
Install the attached behavior pack and apply it to a world.
Once in the world, sneak with an empty hand. This should meet all the conditions for an event to trigger a command.
Observe chat for a success message.
→❌ Nothing occurs. The filter looking for air and looking for an empty string could not succeed.
Attachments
Comments 4
Hello, thank you for getting back to me, and sorry for the delay.
Yes, the original behavior pack included an animation controller that would run a /say
command if a trigger in the environment sensor in the player's behavior file could succeed; it applied an event that changed the player's "minecraft:variant" component and used that as a condition in the controller. This was done to not utilize experimental features, but in hindsight it does make where the issue is less clear.
I have made a new version of the pack that should make demonstration of the issue simpler; this uses the run_command
event response under the Holiday Creator Features experiment to run the command more directly and it should print a message in chat once every tick while sneaking with an empty hand. The problem is still in the environment sensor however, it is unable to run an event because neither "air"
or an empty string (""
) count as valid item IDs for the filter. I hope this was able to clear up some confusion.
I just ran into the same problem. I have an entity that you can give any item to (allay runtime). The allay has give and take on the same left trigger, one when the player has empty hands (take) and one when the player is holding something (give). (which by the way is logically backwards syntax as the allay is the subject of the interaction, but that's another ticket...) 🙂
So, I'd like to filter when the entity is empty handed and only allow "give", when the entity is NOT equipped. I'd like to do something different with the left trigger on interact if the entity is equipped already. Short of naming every possible item the entity can receive to check that, in fact, the entity is equipped, which my entity, like the allay, is doing, it makes sense that I could do the opposite in a simple interact filter. I'd want to check for something like "not" in the filter. or null, or empty. Maybe there is a way to do this, but I cant find it. I can do this with any other language. We do it with the query functions. !query.is_baby is valid testing for adult in certain circumstances. What we need is something like this:
"test":"has_equipment",
"domain": "hand","subject": "self",
"operator": "<>" (or "!=" or "not" )
"value": ""
This of course means the entity is equipped, and we don't care with what precisely the entity is holding. But the behavior entity won't allow you to filter for empty hands without providing some "namespace:item_name" which has to be an oversight, or its my error and I'm just missing it in the docs.
I would not mind making a reasonable filter using, say, categories, like where I could encompass the entirety of the library or potential equip-able objects but no such library of categories exist, that I can find other than this... https://learn.microsoft.com/en-us/minecraft/creator/reference/content/recipereference/examples/recipetaglist
Anyway, I wanted to clarify the issue, and perhaps suggest this improvement, or I humbly accept that I am missing it.
Note from todays(4/19/23) Beta:
Introduced new entity filters "all_slots_empty" and "any_slot_empty" to allow searching for empty item slots in a designated equipment location (MCPE-153909)
Without context the filter is??
"test":"any_slot_empty",
"domain": "hand",
"subject": "self",
"operator": "==",
"value": true
or is it
"test":"all_slots_empty",
"domain": "all",
"subject": "self",
"operator": "==",
"value": true
So the shortened code looks like
"test":"any_slot_empty",
"domain": "hand",
"value": true
and
"test":"all_slots_empty",
"value": true
Did I get that correct?
Thank you for your report!
However, this issue has been temporarily closed as Awaiting Response.
What should happen instead if the mcpack was functioning correctly? Should a message appear in the chat? If yes, where is this message included in the mcpack?
This ticket will automatically reopen when you reply.
Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📓 Project Summary – 📧 Suggestions – 📖 Minecraft Wiki