Parallel recipes would not start if energy is not sufficient for running it at maximum parallel amount.
YiRanMushroom opened this issue ยท 1 comments
Checked for existing issues
- I have checked for existing issues, and have found none.
Tested latest version
- I have checked that this occurs on the latest version.
GregTech CEu Version
1.2.2.a-build_680
Recipe Viewer Installed
JEI
Environment
Singleplayer
Cross-Mod Interaction
No
Other Installed Mods
Parallel recipes would not start if energy is not sufficient for running it at maximum parallel amount, although it is sufficient for running at a lower parallel amount. And this is possibly only true for those machine need a parallel controll hatch to run parallel recipes. (I tested on Large Engraving Lazer)
Expected Behavior
I used a HV energy hatch on Large Engraving Lazer, tested the recipe of using glass lens and flawed enerald to craft exquisite emerald, and set the parallel amount to be 4. The recipe should run with parallel amount of 2.
Actual Behavior
The recipe didn't start.
Steps to Reproduce
As I said above.
Additional Information
There could be some wrong logic in hatchParallel method. However I didn't see any problem with that.
Change the method to this will work;
public static Pair<GTRecipe, Integer> hatchParallel(MetaMachine machine, @NotNull GTRecipe recipe, boolean modifyDuration) {
if (machine instanceof IMultiController controller && controller.isFormed()) {
Optional<IParallelHatch> optional = controller.getParts().stream().filter(IParallelHatch.class::isInstance).map(IParallelHatch.class::cast).findAny();
if (optional.isPresent()) {
IParallelHatch hatch = optional.get();
if (machine instanceof WorkableElectricMultiblockMachine workableMachine)
return ParallelLogic.applyParallel(machine, recipe,
(int) Math.min(hatch.getCurrentParallel(),
(workableMachine.getMaxVoltage() / RecipeHelper.getInputEUt(recipe))),
modifyDuration);
else
return ParallelLogic.applyParallel(machine, recipe, hatch.getCurrentParallel(), modifyDuration);
// This should never reach, maybe it's a good idea to return null here.
}
}
return Pair.of(recipe, 1);
}
Also I am curious that why the logic cannot check the voltage problem correctly in EURecipeCapability, I looked through the code and I think they are correct. Also if EURecipeCapability doesn't work, we may also need to modify accurateParallel to add additional checks for voltage to prevent other unexpected errors.