diff options
author | xSkewer <43712386+xSkewer@users.noreply.github.com> | 2022-07-05 10:43:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-05 21:43:01 +0700 |
commit | b717d3fcb533ee0d187b0759f514ca4cb9c955c0 (patch) | |
tree | fee3855c8c11e4c12ea220315bd56341711c4ab4 /src/main/java/gtPlusPlus/xmod/gregtech | |
parent | d8f2adc352c1d9ac1c810686f1befe2ac181c673 (diff) | |
download | GT5-Unofficial-b717d3fcb533ee0d187b0759f514ca4cb9c955c0.tar.gz GT5-Unofficial-b717d3fcb533ee0d187b0759f514ca4cb9c955c0.tar.bz2 GT5-Unofficial-b717d3fcb533ee0d187b0759f514ca4cb9c955c0.zip |
Fix XL Turbine mufflers (#227)
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech')
-rw-r--r-- | src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java index e387b177b8..5734466a4d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java @@ -64,6 +64,7 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM protected int maintenanceThreshold = 1; protected int pollutionMultiplier = 1; protected int turbineDamageMultiplier = 1; + protected double mufflerReduction = 1; public ITexture frontFace; public ITexture frontFaceActive; @@ -175,6 +176,16 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM return getPollutionPerSecond(null) > 0; } + public final double getMufflerReduction() { + double totalReduction = 0; + for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { + if (isValidMetaTileEntity(tHatch)) { + totalReduction += ((double) tHatch.calculatePollutionReduction(100)) / 100; + } + } + return totalReduction / 4; + } + @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { this.mDynamoHatches.clear(); @@ -213,6 +224,7 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM ", Casing Count: "+aCasingCount+" | Found: "+mCasing); return false; } + mufflerReduction = getMufflerReduction(); log("Built "+this.getLocalName()+" with "+mCasing+"/360 casings."); return aCasingCount && aStructure; } @@ -644,13 +656,8 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM @Override public String[] getExtraInfoData() { - int mPollutionReduction=0; - for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { - if (isValidMetaTileEntity(tHatch)) { - mPollutionReduction=Math.max(StaticFields59.calculatePollutionReducation(tHatch, 100),mPollutionReduction); - } - } - + int mPollutionReduction=(int) (100 * mufflerReduction); + String tRunning = mMaxProgresstime > 0 ? EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.running.true")+EnumChatFormatting.RESET : EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.running.false")+EnumChatFormatting.RESET; @@ -706,7 +713,7 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM public boolean polluteEnvironment(int aPollutionLevel) { if (this.requiresMufflers()) { - mPollution += aPollutionLevel * pollutionMultiplier; + mPollution += aPollutionLevel * pollutionMultiplier * mufflerReduction; for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { if (isValidMetaTileEntity(tHatch)) { if (mPollution >= 10000) { |