Tech Reborn

Tech Reborn

30M Downloads

Machines check all recipes when trying to insert

Technici4n opened this issue ยท 0 comments

commented

Machines check all recipes when they check if an item is valid for an input slot. For example, see this profile from a public AOF server:
image
(The pipe stuff is actually a similar issue where the puller is checking if an item is a valid furnace fuel, and I'm already working on a fix: FabricMC/fabric#1108)

I think this can be solved by building a cache Map<Item, List<Recipes>> that lists every recipe that uses a given item. That way, you only need to match on the cached recipes that are already using one of the items. That should improve performance for all machines. I did something similar with my mod, see https://github.com/AztechMC/Modern-Industrialization/blob/1ae80da2d1f6df7d32d284d7e3c391b855947695/src/main/java/aztech/modern_industrialization/machines/recipe/MachineRecipeType.java#L42.