GTNewHorizons / NotEnoughItems

GNU Lesser General Public License v3.0
51 stars 73 forks source link

[Suggestion] Add Inventory Detection to NEI Bookmarks and JEC logic #538

Open Legend2579 opened 1 day ago

Legend2579 commented 1 day ago

My suggestion is to combine the functionality of the pull bookmarked items feature with the recipe calculation from JustEnoughCalculation. JEC has inventory detection and can dynamically adjust the amount of ingredients needed for a craft if the player already has it in their inventory. Players can also set default recipes within JEC so they don't have to recreate entire crafting trees for complex items. However, JEC is not included in the pack by default and is not compatible with NEI bookmarks.

The ability to pull bookmarked items is a huge quality of life upgrade, useful for early game when you have dozens of disorganized chests with random ingredients spread apart all over the place. Who needs organization when you can instantly withdraw everything you need with 1 button? In my experience on my last playthrough, using bookmarks and pulling ingredients from disorganized chests was much more effective than trying to stay organized when it came to progressing through the early tiers.

Right now the way 'Pull all Bookmarked Items' and 'Pull all Bookmarked Ingredients' works is that is will take all raw ingredients from the crafting tree, AND any intermediate crafting ingredients required. Additionally, if ingredients are spread out between multiple chests and you use this key bind multiple times, it will continue to pull ingredients from the crafting tree, despite already having them in your inventory. This results in more materials than necessary being withdrawn from chests if some of the components are already crafted and available.

Here is an example with the crafting tree for a hopper with NEI Bookmarks:

image

image

Here is the same crafting tree shown within JEC.

image

This second image shows the required steps. I have no items in my inventory.

image

I put the chest and iron plates in my inventory and it automatically updated the crafting tree.

image

Next I will show how the auto pull bookmarked items is behaving. I have a chest containing a combination of raw and intermediate products needed for the hopper. The chest and iron plates are already crafted so it should only take out a few additional items to finish the craft.

image

When I press V to withdraw items, it pulls everything shown below instead of only the chest, 9 iron plates, and 4 additional iron ingots.

image

These are the ingredients that it pulled. There are a few things to note:

  1. It took out the chest but it also withdrew extra ingredients to make another one.
  2. It took out 2 pieces of flint and gravel despite the recipe only needing 1 flint.
  3. It took out too much iron because it already has some of the iron plates. It only needed to pull 4 ingots.

I think that the pull bookmarks feature is underrated and incredible for crafting circuits pre-AE2, but it can be made more powerful by adapting JECs functionality. It should use the same logic and inventory detection that JEC uses. It should also follow JECs crafting plan and withdraw items from right to left, starting with the final product and working backwards. It should search and pull intermediate products it needs first, and only pull raw ingredients if the prerequisite items are not available.

slprime commented 1 day ago

I'll think about it

P.S. shift+v - pull only ingredients