minetest-mods / unified_inventory

An extensible inventory mod which allows searching crafting and browsing for recipes in the same dialogue.
Other
50 stars 38 forks source link

Add u_i initialization and craft registration callbacks #184

Closed oversword closed 3 years ago

oversword commented 3 years ago

This helps fix https://github.com/BlockySurvival/issue-tracker/issues/92 And is related to a point in https://github.com/BlockySurvival/issue-tracker/issues/341

It's a common issue that the most useful craft is rarely the first one to appear in the list

This is due to some crafts being registered or overridden after the origin mod has loaded

There doesn't seem to be any easy solution, any way the current logic in this mod could be changed to change the order of crafts would inevitably cause some crafts to fall out of the ideal order.

This solution provides an API method to add custom sorting methods, one for each item if required. This will allow server maintainers to organise crafts however they see fit: if they think digging recipes should appear first, they can make it that way; if they think crafts containing any item matching dye:.* should be pushed to the end they can do that too, or any indefinitely complex logic they desire.

oversword commented 3 years ago

Here is an example of how this might be implemented https://github.com/BlockySurvival/bls_custom/pull/61/files

SmallJoker commented 3 years ago

:+1: looks good. Will merge in the next few days.