Changes eu/t to use long instead of int in RecipeMap and RecipeLogic code.
Removes negative eu/t values being used to denote generation part way through recipe logic. Negative eu/t is only set in setupRecipe() now. Otherwise it is always positive.
Implements sub-tick overclocking, and overhauls related overclocking code.
Sub-Tick Overclocking
Sub-Tick Overclocking allows recipes to still gain benefits when overclocked beyond 1 tick. Previously overclocking just stopped at this point, but now it can continue and provide benefits for doing so. There are three types of overclocking behavior: standard, parallel sub-tick, and non-parallel subtick.
Standard overclocking behavior works identically to the original overclocking behavior. It overclocks as much as possible but stops once 1 tick recipe duration has been reached. This is the default logic used anywhere not covered by the following types.
Parallel Sub-Tick overclocking will overclock to 1 tick as usual. Starting with the overclock that brings the duration below 1 tick and all future overclocks, duration is kept at 1 tick, energy is increased, and parallel is increased by the amount the duration is divided by. An example would be a 4x energy and 0.5x duration overclock. When overclocking past one tick, energy is still 4x larger, but parallel is now 1 / 0.5 = 2. After the overclock completes, the recipe will be parallelized with the MULTIPLY methodology. If there is not enough input to parallelize all the way, EUt is adjusted accordingly. This logic is used for standard multiblock machines.
Non-parallel Sub-Tick overclocking will overclock to 1 tick as usual. Starting with the overclock that brings duration below 1 tick and all future overclocks, duration is kept at 1 tick, and energy is divided by the duration divisor. For example, a 4x energy and 0.5x duration overclock, when overclocked past 1 tick, energy is now 0.5x smaller, and duration remains the same. This logic is used for single block machines, and the PA (since the PA runs single block machines).
Implementation Details
Removed the arbitrary int[] arrays used to store overclocking values. These values now have dedicated classes and are re-used to limit allocations in recipe logic.
AbstractRecipeLogic#subTickOC currently is forced to copy the found recipe to override its EUt. I wanted to avoid modifying ParallelLogic if possible, so I left this current implementation. For the future if we decide to modify parallel code, we can likely get rid of the copy.
Outcome
Moves recipe logic to use long instead of int for consistency with the energy API.
Cleans up negative eut behavior and ensure its consistency in recipe logic.
Implements sub-tick overclocking mechanics.
Potential Compatibility Issues
Changes are fully breaking, but should not prove too difficult to resolve.
What
This PR changes three components of recipe logic.
long
instead ofint
inRecipeMap
andRecipeLogic
code.setupRecipe()
now. Otherwise it is always positive.Sub-Tick Overclocking
Sub-Tick Overclocking allows recipes to still gain benefits when overclocked beyond 1 tick. Previously overclocking just stopped at this point, but now it can continue and provide benefits for doing so. There are three types of overclocking behavior: standard, parallel sub-tick, and non-parallel subtick.
Standard overclocking behavior works identically to the original overclocking behavior. It overclocks as much as possible but stops once 1 tick recipe duration has been reached. This is the default logic used anywhere not covered by the following types.
Parallel Sub-Tick overclocking will overclock to 1 tick as usual. Starting with the overclock that brings the duration below 1 tick and all future overclocks, duration is kept at 1 tick, energy is increased, and parallel is increased by the amount the duration is divided by. An example would be a 4x energy and 0.5x duration overclock. When overclocking past one tick, energy is still 4x larger, but parallel is now
1 / 0.5 = 2
. After the overclock completes, the recipe will be parallelized with theMULTIPLY
methodology. If there is not enough input to parallelize all the way, EUt is adjusted accordingly. This logic is used for standard multiblock machines.Non-parallel Sub-Tick overclocking will overclock to 1 tick as usual. Starting with the overclock that brings duration below 1 tick and all future overclocks, duration is kept at 1 tick, and energy is divided by the duration divisor. For example, a 4x energy and 0.5x duration overclock, when overclocked past 1 tick, energy is now 0.5x smaller, and duration remains the same. This logic is used for single block machines, and the PA (since the PA runs single block machines).
Implementation Details
Removed the arbitrary
int[]
arrays used to store overclocking values. These values now have dedicated classes and are re-used to limit allocations in recipe logic.AbstractRecipeLogic#subTickOC
currently is forced to copy the found recipe to override itsEUt
. I wanted to avoid modifyingParallelLogic
if possible, so I left this current implementation. For the future if we decide to modify parallel code, we can likely get rid of the copy.Outcome
Moves recipe logic to use
long
instead ofint
for consistency with the energy API. Cleans up negative eut behavior and ensure its consistency in recipe logic. Implements sub-tick overclocking mechanics.Potential Compatibility Issues
Changes are fully breaking, but should not prove too difficult to resolve.