Extend the representative-item logic to handle ingredients specified
as the intersection of multiple groups. Also add mangling of item
button content, because comma for a multi-group ingredient is getting
formspec-escaped and then not de-escaped.
Alloy cooking recipes have quantities for the ingredients, which need to
be shown. The buttons on which the ingredients are shown don't natively
support showing an item count, so hack it up with the label facility.
Also, the button names, supporting clicking to see recipes recursively,
need to be based only on the item name part of the ingredient, dropping
the quantity part.
The refill slot was only putting as many items as possible in a
stack, which does nothing for tools. Tools could benefit from repair,
recharging, or other behaviour depending on the type of tool. Change the
default refill behaviour to repair mechanical wear as well as fully
stacking. Because other kinds of refill will require knowledge of the
metadata format, they can't be directly handled here. So add an on_refill
hook, that tool definitions can supply to plug in appropriate behaviour.
Keep the current inventory search string when performing inventory
form actions other than searching. This means the player's input is
not lost if the player breaks off from entering it to switch pages,
or if the player absent-mindedly ends text input with <return>.