diff options
| author | Sampsa <69092953+S4mpsa@users.noreply.github.com> | 2024-09-09 19:25:33 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-09 18:25:33 +0200 |
| commit | 4058d5abf8f70468af8acb50758da927b2aedf82 (patch) | |
| tree | 610bcff537bf618c27fe91982472f0d1bf56d93f /src/main/java/goodgenerator/blocks/tileEntity/base | |
| parent | abba7f744b7e215a5de73b15c2234caaf97ec91e (diff) | |
| download | GT5-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/blocks/tileEntity/base')
| -rw-r--r-- | src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java | 35 |
1 files changed, 20 insertions, 15 deletions
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) { |
