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 rotary hearth furnace parallel not taking energy discount into account #2756

Open
wants to merge 1 commit into
base: 1.20.1
Choose a base branch
from
Open
Show file tree
Hide file tree
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 @@ -149,29 +149,50 @@ public class GTRecipeModifiers {
* @return A {@link ModifierFunction} for the given Blast Furnace
*/
public static @NotNull ModifierFunction ebfOverclock(@NotNull MetaMachine machine, @NotNull GTRecipe recipe) {
var oc = ebfOverclockOnly(machine,recipe);
var discount = ebfDiscount(machine,recipe);
return oc.compose(discount);
}

private static boolean ebfRecipeRequirementsMet(@NotNull GTRecipe recipe, int blastFurnaceTemperature,CoilWorkableElectricMultiblockMachine coilMachine){
int recipeTemp = recipe.data.getInt("ebf_temp");
return (recipe.data.contains("ebf_temp")
&& recipeTemp <= blastFurnaceTemperature
&& RecipeHelper.getRecipeEUtTier(recipe) <= coilMachine.getTier());
}
private static int getBlastFurnaceTemperature(CoilWorkableElectricMultiblockMachine coilMachine){
return coilMachine.getCoilType().getCoilTemperature() +
(100 * Math.max(0, coilMachine.getTier() - GTValues.MV));
}

public static @NotNull ModifierFunction ebfOverclockOnly(@NotNull MetaMachine machine, @NotNull GTRecipe recipe) {
if (!(machine instanceof CoilWorkableElectricMultiblockMachine coilMachine)) {
return RecipeModifier.nullWrongType(CoilWorkableElectricMultiblockMachine.class, machine);
}

int blastFurnaceTemperature = coilMachine.getCoilType().getCoilTemperature() +
(100 * Math.max(0, coilMachine.getTier() - GTValues.MV));
int blastFurnaceTemperature = getBlastFurnaceTemperature(coilMachine);
int recipeTemp = recipe.data.getInt("ebf_temp");
if (!recipe.data.contains("ebf_temp") || recipeTemp > blastFurnaceTemperature) {
if (!ebfRecipeRequirementsMet(recipe,blastFurnaceTemperature,coilMachine)){
return ModifierFunction.NULL;
}

if (RecipeHelper.getRecipeEUtTier(recipe) > coilMachine.getTier()) {
OverclockingLogic logic = (p, v) -> OverclockingLogic.heatingCoilOC(p, v, recipeTemp, blastFurnaceTemperature);

return logic.getModifier(machine, recipe, coilMachine.getOverclockVoltage());
}

public static @NotNull ModifierFunction ebfDiscount(@NotNull MetaMachine machine, @NotNull GTRecipe recipe) {
if (!(machine instanceof CoilWorkableElectricMultiblockMachine coilMachine)) {
return RecipeModifier.nullWrongType(CoilWorkableElectricMultiblockMachine.class, machine);
}
int blastFurnaceTemperature = getBlastFurnaceTemperature(coilMachine);
int recipeTemp = recipe.data.getInt("ebf_temp");
if (!ebfRecipeRequirementsMet(recipe,blastFurnaceTemperature,coilMachine)){
return ModifierFunction.NULL;
}

var discount = ModifierFunction.builder()
return ModifierFunction.builder()
.eutMultiplier(getCoilEUtDiscount(recipeTemp, blastFurnaceTemperature))
.build();

OverclockingLogic logic = (p, v) -> OverclockingLogic.heatingCoilOC(p, v, recipeTemp, blastFurnaceTemperature);
var oc = logic.getModifier(machine, recipe, coilMachine.getOverclockVoltage());

return oc.compose(discount);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -833,8 +833,8 @@ public static void init() {}
Component.translatable("gtceu.machine.electric_blast_furnace.tooltip.2"))
.rotationState(RotationState.ALL)
.recipeType(BLAST_RECIPES)
.recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH,
GTRecipeModifiers::ebfOverclock)
.recipeModifiers(GTRecipeModifiers::ebfDiscount,
GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers::ebfOverclockOnly)
.appearanceBlock(CASING_HIGH_TEMPERATURE_SMELTING)
.pattern(definition -> {
TraceabilityPredicate casing = blocks(CASING_HIGH_TEMPERATURE_SMELTING.get()).setMinGlobalLimited(360);
Expand Down