-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb3c7aa
commit fc54b39
Showing
4 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
src/main/java/cn/taskeren/gtnn/mixin/gtpp/GT_MTE_LargeTurbine_PlasmaMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
src/main/java/cn/taskeren/gtnn/mixin/gtpp/GT_MTE_LargeTurbine_SCSteamMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters