Recipe Book Access API

Recipe Book Access is an intuitive Fabric API that makes it easy to add support for external inventory access in any crafting screen. This technology redirects the recipe book functionality to check and use items from a customizable list of inventories instead of just the player's inventory.
How does it work in practice?
See for yourself:

This example demonstrates the work of a modified crafting table that uses a custom list of inventories through this API. In this particular case, all inventories from nearby chests are utilized.
Important note
This mod alone will not provide the functionality shown in the demonstration! If you're looking for an implementation of this mechanism for the standard crafting table, you should check out the "Nearby Crafting" mod.
Quick start
API provides a simple interface called RecipeBookInventoryProvider, located in the com.jomlom.recipebookaccess.api package.
Your screen handler class must implement this interface. For the full API functionality, only one method needs to be overridden - getInventoriesForAutofill().
In your implementation of this method, you need to return a list of inventories that the recipe book should have access to for autofill. By default, the player's inventory is not included in this list.
Code example:
import com.jomlom.recipebookaccess.api.RecipeBookInventoryProvider;
public class YourCraftingScreenHandler extends AbstractRecipeScreenHandler implements RecipeBookInventoryProvider {
// your existing code...
@Override
public List<Inventory> getInventoriesForAutofill() {
return yourInventoriesList;
}
}
Assumptions made by the API:
- Your screen handler class extends "AbstractRecipeScreenHandler" or any of its subclasses
- The corresponding screen extends "RecipeBookScreen" to use Minecraft's standard recipe book
(no testing has been conducted outside these assumptions)
Frequently asked questions
Question: I found an issue... Answer: Create an issue on GitHub or contact directly on Discord: @joonty
Question: Will support for [specific version/platform] be added? Answer: Support for older versions is planned to be released soon. Support for other loaders (Forge, NeoForge, etc.) is not currently planned. If you want to create a version for another loader, contact via Discord.
Question: Does my implementation of the getInventoriesForAutofill() method need to work on the client side?
Answer: No! The getInventoriesForAutofill() method is only used on the server side in the screen handler. API automatically synchronizes the result with the client.