aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java60
1 files changed, 26 insertions, 34 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java
index 15dc5def03..1a055077ba 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java
@@ -21,6 +21,7 @@ import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
@@ -51,6 +52,7 @@ import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.util.GTUtility;
import gregtech.api.util.LightingHelper;
+import gregtech.api.util.TurbineStatCalculator;
import gregtech.api.util.shutdown.ShutDownReasonRegistry;
import gregtech.common.items.MetaGeneratedTool01;
import gregtech.common.render.GTRenderUtil;
@@ -265,6 +267,11 @@ public abstract class MTELargeTurbine extends MTEEnhancedMultiBlockBase<MTELarge
stopMachine(ShutDownReasonRegistry.NO_TURBINE);
return CheckRecipeResultRegistry.NO_TURBINE_FOUND;
}
+
+ TurbineStatCalculator turbine = new TurbineStatCalculator(
+ (MetaGeneratedTool) controllerSlot.getItem(),
+ controllerSlot);
+
ArrayList<FluidStack> tFluids = getStoredFluids();
if (!tFluids.isEmpty()) {
@@ -275,21 +282,10 @@ public abstract class MTELargeTurbine extends MTEEnhancedMultiBlockBase<MTELarge
|| 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));
-
- overflowMultiplier = getOverflowMultiplier(controllerSlot);
-
- flowMultipliers[0] = MetaGeneratedTool.getPrimaryMaterial(controllerSlot).mSteamMultiplier;
- flowMultipliers[1] = MetaGeneratedTool.getPrimaryMaterial(controllerSlot).mGasMultiplier;
- flowMultipliers[2] = MetaGeneratedTool.getPrimaryMaterial(controllerSlot).mPlasmaMultiplier;
+ baseEff = (int) turbine.getEfficiency();
+ optFlow = (int) turbine.getOptimalFlow();
+
+ overflowMultiplier = turbine.getOverflowEfficiency();
if (optFlow <= 0 || baseEff <= 0) {
stopMachine(ShutDownReasonRegistry.NONE); // in case the turbine got removed
@@ -300,10 +296,10 @@ public abstract class MTELargeTurbine extends MTEEnhancedMultiBlockBase<MTELarge
}
}
- int newPower = fluidIntoPower(tFluids, optFlow, baseEff, overflowMultiplier, flowMultipliers); // 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
@@ -329,8 +325,7 @@ public abstract class MTELargeTurbine extends MTEEnhancedMultiBlockBase<MTELarge
}
}
- abstract int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff, int overflowMultiplier,
- float[] flowMultipliers);
+ abstract int fluidIntoPower(ArrayList<FluidStack> aFluids, TurbineStatCalculator turbine);
abstract float getOverflowEfficiency(int totalFlow, int actualOptimalFlow, int overflowMultiplier);
@@ -344,19 +339,6 @@ public abstract class MTELargeTurbine extends MTEEnhancedMultiBlockBase<MTELarge
return aTotal;
}
- public int getOverflowMultiplier(ItemStack aStack) {
- int aOverflowMultiplier = 0;
- int toolQualityLevel = MetaGeneratedTool.getPrimaryMaterial(aStack).mToolQuality;
- if (toolQualityLevel >= 6) {
- aOverflowMultiplier = 3;
- } else if (toolQualityLevel >= 3) {
- aOverflowMultiplier = 2;
- } else {
- aOverflowMultiplier = 1;
- }
- return aOverflowMultiplier;
- }
-
@Override
public int getDamageToComponent(ItemStack aStack) {
return 1;
@@ -472,6 +454,16 @@ public abstract class MTELargeTurbine extends MTEEnhancedMultiBlockBase<MTELarge
: this.getMaxEfficiency(mInventory[1]) > 0;
}
+ public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (side == getBaseMetaTileEntity().getFrontFacing()) {
+ looseFit ^= true;
+ GTUtility.sendChatToPlayer(
+ aPlayer,
+ looseFit ? GTUtility.trans("500", "Fitting: Loose - More Flow")
+ : GTUtility.trans("501", "Fitting: Tight - More Efficiency"));
+ }
+ }
+
@Override
public boolean isGivingInformation() {
return true;