aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/goodgenerator
diff options
context:
space:
mode:
authorSampsa <69092953+S4mpsa@users.noreply.github.com>2024-09-09 19:25:33 +0300
committerGitHub <noreply@github.com>2024-09-09 18:25:33 +0200
commit4058d5abf8f70468af8acb50758da927b2aedf82 (patch)
tree610bcff537bf618c27fe91982472f0d1bf56d93f /src/main/java/goodgenerator
parentabba7f744b7e215a5de73b15c2234caaf97ec91e (diff)
downloadGT5-Unofficial-4058d5abf8f70468af8acb50758da927b2aedf82.tar.gz
GT5-Unofficial-4058d5abf8f70468af8acb50758da927b2aedf82.tar.bz2
GT5-Unofficial-4058d5abf8f70468af8acb50758da927b2aedf82.zip
Large Large & Larger Turbine Rework (#3075)
Co-authored-by: Daniel Mendes <steelux7@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: NotAPenguin <michiel.vandeginste@gmail.com> Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/goodgenerator')
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/MTEExtremeHeatExchanger.java34
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/MTESupercriticalFluidTurbine.java44
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java35
-rw-r--r--src/main/java/goodgenerator/loader/RecipeLoader2.java6
4 files changed, 60 insertions, 59 deletions
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTEExtremeHeatExchanger.java b/src/main/java/goodgenerator/blocks/tileEntity/MTEExtremeHeatExchanger.java
index c37a2026d4..582b9d04aa 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/MTEExtremeHeatExchanger.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/MTEExtremeHeatExchanger.java
@@ -210,10 +210,10 @@ public class MTEExtremeHeatExchanger extends MTETooltipMultiBlockBaseEM
.addInfo(BLUE_PRINT_INFO)
.addSeparator()
.addController("Front bottom")
- .addOtherStructurePart("Input Hatch", "Distilled water. Any bottom left/right side casing", 1)
- .addOtherStructurePart("Output Hatch", "SC Steam/SH Steam/Steam. Any top layer casing", 2)
- .addOtherStructurePart("Input Hatch", "Hot fluid or plasma. Front middle on 4th layer", 3)
- .addOtherStructurePart("Output Hatch", "Cold fluid. Back middle on 4th layer", 4)
+ .addOtherStructurePart("Input Hatch", "distilled water", 1)
+ .addOtherStructurePart("Output Hatch", "SC Steam/SH Steam/Steam", 2)
+ .addOtherStructurePart("Input Hatch", "Hot fluid or plasma", 3)
+ .addOtherStructurePart("Output Hatch", "Cold fluid", 4)
.addMaintenanceHatch("Any Casing", 1, 2, 5)
.addCasingInfoMin("Robust Tungstensteel Machine Casings", 25, false)
.toolTipFinisher("Good Generator");
@@ -268,8 +268,15 @@ public class MTEExtremeHeatExchanger extends MTETooltipMultiBlockBaseEM
Fluid tReadySteam = transformed ? tRunningRecipe.getHeatedSteam() : tRunningRecipe.getNormalSteam();
int waterAmount = (int) (this.mEUt / getUnitSteamPower(tReadySteam.getName())) / 160;
if (waterAmount < 0) return false;
+ int steamToOutput;
if (depleteInput(GTModHandler.getDistilledWater(waterAmount))) {
- addOutput(new FluidStack(tReadySteam, waterAmount * 160));
+ if (tRunningRecipe.mFluidInputs[0].getUnlocalizedName()
+ .contains("plasma")) {
+ steamToOutput = waterAmount * 160 / 1000;
+ } else {
+ steamToOutput = waterAmount * 160;
+ }
+ addOutput(new FluidStack(tReadySteam, steamToOutput));
} else {
GTLog.exp.println(this.mName + " had no more Distilled water!");
mHotFluidHatch.getBaseMetaTileEntity()
@@ -281,16 +288,13 @@ public class MTEExtremeHeatExchanger extends MTETooltipMultiBlockBaseEM
}
public double getUnitSteamPower(String steam) {
- switch (steam) {
- case "steam":
- return 0.5;
- case "ic2superheatedsteam":
- return 1;
- case "supercriticalsteam":
- return 100;
- default:
- return -1;
- }
+ return switch (steam) {
+ case "steam" -> 0.5;
+ case "ic2superheatedsteam" -> 1;
+ case "supercriticalsteam" -> 100;
+ case "densesupercriticalsteam" -> 1;
+ default -> -1;
+ };
}
@Override
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTESupercriticalFluidTurbine.java b/src/main/java/goodgenerator/blocks/tileEntity/MTESupercriticalFluidTurbine.java
index a78046909a..e7ea94f3c8 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/MTESupercriticalFluidTurbine.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/MTESupercriticalFluidTurbine.java
@@ -24,6 +24,7 @@ import gregtech.api.render.TextureFactory;
import gregtech.api.util.GTModHandler;
import gregtech.api.util.GTUtility;
import gregtech.api.util.MultiblockTooltipBuilder;
+import gregtech.api.util.TurbineStatCalculator;
public class MTESupercriticalFluidTurbine extends MTELargeTurbineBase {
@@ -42,27 +43,14 @@ public class MTESupercriticalFluidTurbine extends MTELargeTurbineBase {
}
@Override
- public int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) {
- if (looseFit) {
- aOptFlow *= 4;
- double pow = Math.pow(1.1f, ((aBaseEff - 7500) / 10000F) * 20f);
- if (aBaseEff > 10000) {
- aOptFlow *= pow;
- aBaseEff = 7500;
- } else if (aBaseEff > 7500) {
- aOptFlow *= pow;
- aBaseEff *= 0.75f;
- } else {
- aBaseEff *= 0.75f;
- }
- }
+ public int fluidIntoPower(ArrayList<FluidStack> aFluids, TurbineStatCalculator turbine) {
+
int tEU = 0;
int totalFlow = 0; // Byproducts are based on actual flow
int flow = 0;
- int remainingFlow = GTUtility.safeInt((long) (aOptFlow * 1.25f)); // Allowed to use up to 125% of optimal flow.
- // Variable required outside of loop for
- // multi-hatch scenarios.
- this.realOptFlow = aOptFlow;
+ this.realOptFlow = looseFit ? turbine.getOptimalLooseSteamFlow() : turbine.getOptimalSteamFlow();
+ int remainingFlow = GTUtility.safeInt((long) (realOptFlow * 1.25f)); // Allowed to use up to 125% of optimal
+ // flow.
storedFluid = 0;
FluidStack tSCSteam = FluidRegistry.getFluidStack("supercriticalsteam", 1);
@@ -80,20 +68,24 @@ public class MTESupercriticalFluidTurbine extends MTELargeTurbineBase {
}
if (totalFlow <= 0) return 0;
tEU = totalFlow;
- addOutput(GTModHandler.getSteam(totalFlow * 100));
- if (totalFlow == aOptFlow) {
- tEU = GTUtility.safeInt((long) tEU * (long) aBaseEff / 10000L);
+ addOutput(GTModHandler.getSteam(totalFlow));
+ if (totalFlow == realOptFlow) {
+ tEU = GTUtility
+ .safeInt((long) (tEU * (looseFit ? turbine.getLooseSteamEfficiency() : turbine.getSteamEfficiency())));
} else {
- float efficiency = 1.0f - Math.abs((totalFlow - aOptFlow) / (float) aOptFlow);
+ float efficiency = 1.0f - (float) Math.abs((totalFlow - realOptFlow) / (float) realOptFlow);
tEU *= efficiency;
- tEU = Math.max(1, GTUtility.safeInt((long) tEU * (long) aBaseEff / 10000L));
+ tEU = Math.max(
+ 1,
+ GTUtility.safeInt(
+ (long) (tEU * (looseFit ? turbine.getLooseSteamEfficiency() : turbine.getSteamEfficiency()))));
}
if (tEU > maxPower) {
tEU = GTUtility.safeInt(maxPower);
}
- return tEU * 100;
+ return tEU;
}
@Override
@@ -153,8 +145,7 @@ public class MTESupercriticalFluidTurbine extends MTELargeTurbineBase {
.addInfo("Controller block for Supercritical Fluid Turbine")
.addInfo("Needs a Turbine, place inside controller")
.addInfo("Use Supercritical Steam to generate power.")
- .addInfo("Outputs 100L of Steam per 1L of SC Steam as well as producing power")
- .addInfo("1L Supercritical Steam = 100 EU")
+ .addInfo("Outputs 1L of Steam per 1L of SC Steam as well as producing power")
.addInfo("Extreme Heated Steam will cause more damage to the turbine.")
.addInfo("Power output depends on turbine and fitting")
.addInfo("Use screwdriver to adjust fitting of turbine")
@@ -165,6 +156,7 @@ public class MTESupercriticalFluidTurbine extends MTELargeTurbineBase {
.addDynamoHatch("Back center", 1)
.addMaintenanceHatch("Side centered", 2)
.addInputHatch("Supercritical Fluid, Side centered", 2)
+ .addOutputHatch("Superheated Steam, Side centered", 3)
.toolTipFinisher("Good Generator");
return tt;
}
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java b/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java
index 1c298d2b9a..086aa28528 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java
@@ -35,6 +35,8 @@ import gregtech.api.metatileentity.implementations.MTEHatchMuffler;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.util.GTUtility;
+import gregtech.api.util.TurbineStatCalculator;
+import gregtech.api.util.shutdown.ShutDownReasonRegistry;
import gregtech.common.items.MetaGeneratedTool01;
public abstract class MTELargeTurbineBase extends MTEEnhancedMultiBlockBase<MTELargeTurbineBase>
@@ -79,6 +81,7 @@ public abstract class MTELargeTurbineBase extends MTEEnhancedMultiBlockBase<MTEL
protected int storedFluid = 0;
protected int counter = 0;
protected boolean looseFit = false;
+ protected int overflowMultiplier = 0;
protected long maxPower = 0;
public MTELargeTurbineBase(int aID, String aName, String aNameRegional) {
@@ -140,11 +143,17 @@ public abstract class MTELargeTurbineBase extends MTEEnhancedMultiBlockBase<MTEL
if ((counter & 7) == 0 && (controllerSlot == null || !(controllerSlot.getItem() instanceof MetaGeneratedTool)
|| controllerSlot.getItemDamage() < 170
|| controllerSlot.getItemDamage() > 179)) {
- stopMachine();
+ stopMachine(ShutDownReasonRegistry.NO_TURBINE);
return CheckRecipeResultRegistry.NO_TURBINE_FOUND;
}
+
+ TurbineStatCalculator turbine = new TurbineStatCalculator(
+ (MetaGeneratedTool) controllerSlot.getItem(),
+ controllerSlot);
+
ArrayList<FluidStack> tFluids = getStoredFluids();
- if (tFluids.size() > 0) {
+ if (!tFluids.isEmpty()) {
+
if (baseEff == 0 || optFlow == 0
|| counter >= 512
|| this.getBaseMetaTileEntity()
@@ -152,17 +161,13 @@ public abstract class MTELargeTurbineBase extends MTEEnhancedMultiBlockBase<MTEL
|| this.getBaseMetaTileEntity()
.hasInventoryBeenModified()) {
counter = 0;
- baseEff = GTUtility.safeInt(
- (long) ((5F + ((MetaGeneratedTool) controllerSlot.getItem()).getToolCombatDamage(controllerSlot))
- * 1000F));
- optFlow = GTUtility.safeInt(
- (long) Math.max(
- Float.MIN_NORMAL,
- ((MetaGeneratedTool) controllerSlot.getItem()).getToolStats(controllerSlot)
- .getSpeedMultiplier() * MetaGeneratedTool.getPrimaryMaterial(controllerSlot).mToolSpeed
- * 50));
+ baseEff = (int) turbine.getEfficiency();
+ optFlow = (int) turbine.getOptimalFlow();
+
+ overflowMultiplier = turbine.getOverflowEfficiency();
+
if (optFlow <= 0 || baseEff <= 0) {
- stopMachine(); // in case the turbine got removed
+ stopMachine(ShutDownReasonRegistry.NONE); // in case the turbine got removed
return CheckRecipeResultRegistry.NO_FUEL_FOUND;
}
} else {
@@ -170,8 +175,8 @@ public abstract class MTELargeTurbineBase extends MTEEnhancedMultiBlockBase<MTEL
}
}
- int newPower = fluidIntoPower(tFluids, optFlow, baseEff); // How much the turbine should be producing with this
- // flow
+ int newPower = fluidIntoPower(tFluids, turbine); // How much the turbine should be producing with this
+ // flow
int difference = newPower - this.mEUt; // difference between current output and new output
// Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in
@@ -197,7 +202,7 @@ public abstract class MTELargeTurbineBase extends MTEEnhancedMultiBlockBase<MTEL
}
}
- public abstract int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff);
+ public abstract int fluidIntoPower(ArrayList<FluidStack> aFluids, TurbineStatCalculator turbine);
@Override
public int getDamageToComponent(ItemStack aStack) {
diff --git a/src/main/java/goodgenerator/loader/RecipeLoader2.java b/src/main/java/goodgenerator/loader/RecipeLoader2.java
index a66b9360d6..1c4c05948d 100644
--- a/src/main/java/goodgenerator/loader/RecipeLoader2.java
+++ b/src/main/java/goodgenerator/loader/RecipeLoader2.java
@@ -1843,7 +1843,7 @@ public class RecipeLoader2 {
.addTo(plasmaForgeRecipes);
}
- public static float EHEEfficiencyMultiplier = 1.2f;
+ public static float EHEEfficiencyMultiplier = 0.9f;
public static void FinishLoadRecipe() {
for (GTRecipe plasmaFuel : RecipeMaps.plasmaFuels.getAllRecipes()) {
@@ -1872,13 +1872,13 @@ public class RecipeLoader2 {
if (output == null) output = FluidRegistry.getFluidStack("molten." + tOutName, tPlasma.amount);
if (output != null) {
long waterAmount = (long) (tUnit * EHEEfficiencyMultiplier * tPlasma.amount / 160);
- long criticalSteamAmount = (long) (tUnit * EHEEfficiencyMultiplier * tPlasma.amount / 100);
+ long criticalSteamAmount = (long) (tUnit * EHEEfficiencyMultiplier * tPlasma.amount / 1000);
MyRecipeAdder.instance.addExtremeHeatExchangerRecipe(
tPlasma,
output,
FluidRegistry.getFluidStack("ic2distilledwater", (int) waterAmount),
FluidRegistry.getFluidStack("ic2superheatedsteam", 0), // Plasma always outputs SC steam.
- FluidRegistry.getFluidStack("supercriticalsteam", (int) criticalSteamAmount),
+ Materials.DenseSupercriticalSteam.getGas(criticalSteamAmount),
1);
}
}