Skip to content

Commit

Permalink
回退超临界灵宝和铿铀削弱 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
koiNoCirculation authored Feb 28, 2024
1 parent bb3c7aa commit fc54b39
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package cn.taskeren.gtnn.mixin.gtpp;

import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GT_MTE_LargeTurbine_Plasma;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(value = GT_MTE_LargeTurbine_Plasma.class, remap = false)
public class GT_MTE_LargeTurbine_PlasmaMixin {
@Redirect(method = "checkProcessing", at = @At(target = "Ljava/lang/Math;min(FF)F", value = "INVOKE"))
public float removeEffLoss(float v, float u) {
return 1.0f;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package cn.taskeren.gtnn.mixin.gtpp;

import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GT_MTE_LargeTurbine_SCSteam;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GregtechMetaTileEntity_LargerTurbineBase;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;

import java.util.ArrayList;

@Mixin(value = GT_MTE_LargeTurbine_SCSteam.class, remap = false)
public abstract class GT_MTE_LargeTurbine_SCSteamMixin extends GregtechMetaTileEntity_LargerTurbineBase {

public GT_MTE_LargeTurbine_SCSteamMixin(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}

/**
* @author koiNoCirculation
* @reason revert supercritical duranium ichorium nerf
*/
@Overwrite
int fluidIntoPower(ArrayList<FluidStack> aFluids, long aOptFlow, int aBaseEff, float[] flowMultipliers) {
int tEU = 0;
int totalFlow = 0; // Byproducts are based on actual flow
int flow = 0;
this.realOptFlow = (double) aOptFlow * (double) flowMultipliers[0];

int remainingFlow = MathUtils.safeInt((long) (realOptFlow * 1.25f)); // Allowed to use up to 125% of optimal flow.
// Variable required outside of loop for
// multi-hatch scenarios.

storedFluid = 0;
FluidStack tSCSteam = FluidRegistry.getFluidStack("supercriticalsteam", 1);
for (
int i = 0; i < aFluids.size() && remainingFlow > 0; i++) {
if (GT_Utility.areFluidsEqual(aFluids.get(i), tSCSteam, true)) {
flow = Math.min(aFluids.get(i).amount, remainingFlow); // try to use up w/o exceeding remainingFlow
depleteInput(new FluidStack(aFluids.get(i), flow)); // deplete that amount
this.storedFluid += aFluids.get(i).amount;
remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches
totalFlow += flow; // track total input used
}
}
if (totalFlow <= 0) return 0;
tEU = totalFlow;

addOutput(GT_ModHandler.getSteam(totalFlow));
if (totalFlow != realOptFlow) {
float efficiency = 1.0f - Math.abs((totalFlow - (float) realOptFlow) / (float) realOptFlow);
tEU *= efficiency;
tEU = Math.max(1, MathUtils.safeInt((long) tEU * (long) aBaseEff / 10000L));
} else {
tEU = MathUtils.safeInt((long) tEU * (long) aBaseEff / 10000L);
}

return (int) Math.min(tEU * 100L, Integer.MAX_VALUE);
}
}
2 changes: 2 additions & 0 deletions src/main/java/cn/taskeren/gtnn/mixinplugin/Mixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public enum Mixin {
LargeEssentiaGeneratorMixin("goodgenerator.LargeEssentiaGeneratorMixin", TargetedMod.GoodGenerator),

EyeOfHarmonyMixin("tectech.GTMetaTileEntityEOMMixin", TargetedMod.TecTech),
XLPlasmaTurbineMixin("gtpp.GT_MTE_LargeTurbine_PlasmaMixin", TargetedMod.GTPlusPlus),
XLSCTurbineMixin("gtpp.GT_MTE_LargeTurbine_SCSteamMixin", TargetedMod.GTPlusPlus),
;

public final String mixinClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public enum TargetedMod {
NewHorizonsCoreMod("GT: New Horizons", "GTNewHorizonsCoreMod"),
GoodGenerator("GoodGenerator", "GoodGenerator"),
TecTech("TecTech", "TecTech"),
GTPlusPlus("GT++", "GTPlusPlus"),
;

public final String modName;
Expand Down

0 comments on commit fc54b39

Please sign in to comment.