IngredientCalculator

Used to recursively calculate raw material requirements and along products of items/fluids, supporting amount scaling

The two calculateFinal methods are the main entry points, It's supposed to only call them from here.

How it works:

Vanilla items (Not support yet)

calculateFinal ---------------->IngredientCalculation.asIngredient | | PylonItems/PylonFluid ↓ calculateBase --------------------------------------->Find recipe<----------------------╮ (calculate out all the inputs, along products) | | (and the final main product's amount) | | (see baseCalculation) ↓ | | ←------------------------------------------╮ Filter inputs and along products | | Finally calculate the actual inputs' amount | | | | For example: | | | | `` | ↓ | | stack.amount = 11 (the arg) | [Try to find ingredients' recipe] ---╯ | baseCalculation = { | | | inputs = [Ax1, Bx13, Cx19] | | | intermediates = [Mx16, Nx9] | ↓ | outputAmount = 3 ╰-- [Merge ingredients and return value] | } | `` | After scaling (×4), it will be: | baseCalculation = { | inputs = Ax4, Bx52, Cx76 | intermediates = Mx64, Nx36 | outputAmount = 12 | } | ↓ scaling and return value

Author

balugaq

Functions

Link copied to clipboard

Calculate the basic recipe data of a single item (for recursive calculation)

Link copied to clipboard

Calculate material requirements and along products for fluids

Calculate the final material requirements for an item stack with amount (including amount scaling)

Link copied to clipboard

Calculate the single output amount of the main product in the recipe separately