MoLang query "is_item_name_any" does not return anything when slot is skipped.
Affects Version: 1.18.10.03
Summary:
The MoLang query "is_item_name_any" does not return anything when optional slot argument is skipped in some slotnames (inventory, hotbar, armor).
Impact:
Is not possible to check for an item in a whole slotname area regarding the slot number. (Example check for apple item in any inventory slot and not just in a specific one).
Documentation is incorrect or poorly written.
Reproduction Steps:
Download and install the attached world with a behavior pack.
Join the attached world.
Show content log by pressing twice F3 key, opening "Log EndPoint" and "pressing Open Log...".
Make sure "Message Area Toggles" "Molang" is ticked, and "Message Importance Level Toggles" "Inform" are both selected.
Take from the creative inventory yourself an apple, a potato and a bread.
If you put the apple in the last right hotbar Query Test.mcworld
slot the content log will display 8.0 indicating that it was detected.
Remove the apple from that slot to stop the log printing 8.0.
Put the potato in any hotbar slot and leave inventory.
Select it with main hand. It will print 2.0 in the content log.
Deselect it from the main hand.
Put the bread in any main inventory slot (not hotbar, not armor and not offhand).
Check log, it does not print anything as it is not detected by the addon.
Observed Results:
q.is_item_name_any('slot.hotbar', 8, 'minecraft:apple')
Returns
q.is_item_name_any('slot.hotbar', 'minecraft:apple')
Does not return
Same behavior for inventory, armor and enderchest
q.is_item_name_any('slot.weapon.mainhand', 0, 'minecraft:apple')
Returns
q.is_item_name_any('slot.weapon.mainhand', 'minecraft:apple')
Returns
Same behavior for offhand
Other slots untested.
Expected Results:
q.is_item_name_any('slot.hotbar', 8, 'minecraft:apple')
Returns
q.is_item_name_any('slot.hotbar', 'minecraft:apple')
Returns if apple in any hotbar slot
Same behavior for inventory, armor and enderchest
Screenshots/Videos attached: Yes.
Documentation screenshot.
Notes:
Related request to this query: https://compass.minecraft.partners/hc/en-us/community/posts/4418704635539--Request-MoLang-query-is-item-name-any-improvement