cc-tweaked / CC-Tweaked

Just another ComputerCraft fork
https://tweaked.cc
882 stars 206 forks source link

Crafting Recipe API #1869

Open Janrupf opened 1 week ago

Janrupf commented 1 week ago

General idea

Computer should have some way to access the currently registered crafting recipes and query meta information about them. Ideally different types of recipes should be supported, but I think starting with just the crafting table ones would be very nice already.

Why?

This would allow computers (turtles?) attached to storage systems to perform crafting tasks, based on the items in the storage network. Currently this is sort of supported via the network specific means, but this requires crafting patterns to be present in the network.

Additionally, this would allow building some sort of JEI like App, which could calculate how many items you need. In combination with the other peripherals this would make for an amazing system.

Or other stuff in that direction, be creative!

Being able to list all registered items and fluids would also be cool, this could help with a fuzzy search in such applications, however, I'm not sure about the performance implications of an array which contains every single thing registered (maybe an API which performs the search or uses pagination could avoid potential issues).

How?

I would imagine a Lua API which returns data in form of table's about recipes in the same format used for inventories and similar.

Janrupf commented 1 week ago

Of course I find something that fulfills this exact use case 20 minutes after opening this issue: https://docs.siredvin.site/UnlimitedPeripheralWorks/peripherals/recipe_registry/

I personally think this should be a core feature of CC: Tweaked, but I understand if that's something that's better left for external addons,