Cooking for Blockheads (Fabric Edition)

Cooking for Blockheads (Fabric Edition)

2M Downloads

Improve Ingredient Scanning for better performance

BlayTheNinth opened this issue ยท 0 comments

commented

Right now, the kitchen has to search its connected inventories for every recipe shown as well as every single crafting operation. This is a big waste because we already know that items are generally going to be in the same place or at least in the same general area. For example, a storage drawer holding wheat will most likely hold more wheat and thus should be preferred when searching for wheat the next time. A slot in a chest containing an apple will likely hold more apples, and if not, it's still more likely that there are more apples in this chest than in any other connected inventory.

Ideas so far:

  • This cache should live in memory only
  • Ensure a consistent order of providers available to the kitchen
  • For each ingredient scanned, remember the index of the provider (and optionally, slot)
  • When searching for this ingredient again, check the last known location first

Blocked by #673