Integrated Crafting

Integrated Crafting

31M Downloads

Add a predicate to the crafting writer

Corfiot opened this issue · 3 comments

commented

Issue type:

  • ➕ Feature request

Short description:

I want to be able to create a predicate, for example "Do I have less than X items in machine's Y slot Z?" and put that in the crafting writer for the item in question. Then the writer would craft if the result is predicate is true.

Concrete example:
craft enriched redstone items for mekanism's infusing factories, I read the infusion level from the machine via NBT and want to only craft when that is not full.

There are workarounds but I don't like them.

commented

Thanks for the suggestion!

commented

So this would accept an operator that takes no inputs and returns an ingredient/recipe if I understand correctly?

commented

A valid question, I guess it could return a recipe but that, IMHO, would be a separate feature, to be implemented after & in addition to this one.

In my original thought it was a predicate returning boolean. True=keep crafting, false=stop crafting. I would expect not to break the pattern in the other components, e.g. the filtering item interface, which auto-populates stuff like Item/uname/name.

The predicate would probably use the writer's recipe as input, from which anything needed to make a decision can be extracted.
In the example I gave, it would take the infusion item created from the output ingredients, count its amount in the machine, then return lessthan(#items_in_network,#desiredamounttohave*const_infusionamountperitemproduced).

Yes it would be complicated but not much more than the items-in-chest-by-mod tutorial.