Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Multi smelter not overclocking #2008

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.capability.IParallelHatch;
import com.gregtechceu.gtceu.api.capability.recipe.EURecipeCapability;
import com.gregtechceu.gtceu.api.capability.recipe.IRecipeCapabilityHolder;
import com.gregtechceu.gtceu.api.data.medicalcondition.MedicalCondition;
import com.gregtechceu.gtceu.api.machine.MetaMachine;
Expand All @@ -12,6 +13,8 @@
import com.gregtechceu.gtceu.api.recipe.GTRecipe;
import com.gregtechceu.gtceu.api.recipe.OverclockingLogic;
import com.gregtechceu.gtceu.api.recipe.RecipeHelper;
import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic;
import com.gregtechceu.gtceu.api.recipe.content.Content;
import com.gregtechceu.gtceu.api.recipe.content.ContentModifier;
import com.gregtechceu.gtceu.api.recipe.logic.OCParams;
import com.gregtechceu.gtceu.api.recipe.logic.OCResult;
Expand All @@ -30,6 +33,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;
import java.util.Optional;
import java.util.function.BiFunction;
import java.util.function.Function;
Expand Down Expand Up @@ -243,17 +247,22 @@ public static GTRecipe multiSmelterParallel(MetaMachine machine, @NotNull GTReci
var maxParallel = 32 * coilMachine.getCoilType().getLevel();
final int FURNACE_DURATION = 128;
var parallel = GTRecipeModifiers.accurateParallel(machine, recipe, maxParallel, false);
// double durationForParallel = Math.max(1.0, FURNACE_DURATION * 2 * parallel.getSecond() / Math.max(1,
// maxParallel * 1.0));

int parallelValue = parallel.getSecond();
long eut = 4 * (parallelValue / 8) / coilMachine.getCoilType().getEnergyDiscount();
result.init(eut, Math.max(1, 256 * parallelValue / maxParallel), parallelValue, params.getOcAmount());
/*
* recipe.duration = Math.max(1, 256 * parallelValue / maxParallel);
* recipe.tickInputs.put(EURecipeCapability.CAP, List.of(new Content(eut,
* ChanceLogic.getMaxChancedValue(), ChanceLogic.getMaxChancedValue(), 0, null, null)));
*/
long eut = 4 * Math.max(1, (parallelValue / 8) / coilMachine.getCoilType().getEnergyDiscount());
int duration = (int) Math.max(1, FURNACE_DURATION * 2 * parallelValue / Math.max(1, maxParallel * 1.0));

recipe.duration = duration;
recipe.tickInputs.put(EURecipeCapability.CAP, List.of(new Content(eut,
ChanceLogic.getMaxChancedValue(), ChanceLogic.getMaxChancedValue(),
0, null, null)));

var re = RecipeHelper.applyOverclock(new OverclockingLogic((p, r, maxVoltage) -> {
OverclockingLogic.NON_PERFECT_OVERCLOCK.getLogic()
.runOverclockingLogic(params, result, maxVoltage);
}), recipe, coilMachine.getOverclockVoltage(), params, result);
recipe = recipe.copy(ContentModifier.multiplier(parallelValue), false);

return recipe;
}
return null;
Expand Down