xxx
This version has been custom-modified for this specific project, for 1.20.3-. Expect differences from the standardized version
xxx

Searches player's inventory for an item, then does something

*** INPUT PARAMETERS ***
************************

- "item" <full item info>  |  Ex. {"item":"minecraft:apple[minecraft:custom_data={Food:1b}]"}
The item to find. Accepts "*" and "#" as well

- "locations" [inventory,hotbar,offhand,armor,cursor]  |  Ex. {"locations":"[inventory,armor]"}
Where in the inventory the search will look for the item. Accepts any combination of "inventory" "hotbar" "offhand" "armor" "cursor"

(WIP) - "success_max" <int> | Ex. {"success_max":"1"}
The maximum number of times the search can be successful before the process is stopped. Maybe it's sufficient to find one matching item and end the search there, for example

- "function" <functionname>  |  Ex. {"function":"datapack:my_function"}
The function to run if the item is found. Runs for every instance the item is located



*** EXAMPLES ***
****************
All parameters are required. Run below function as a macro

~~~~~
Searches for an apple with custom data "Food:1b", located in the inventory, hotbar, & offhand. After the 5th matching item is found, the search is ended. For each item found, runs the function "datapack:my_function"
/function ac_lib:utility/search_inv/do {"item":"minecraft:apple[minecraft:custom_data={Food:1b}]","locations":"[inventory,hotbar,offhand]","success_max":"5","function":"datapack:my_function"}
~~~~~