aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java9
-rw-r--r--src/main/java/bartworks/common/tileentities/multis/mega/MegaMultiBlockBase.java9
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java8
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/MTEExtendedPowerMultiBlockBase.java8
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/MTEHatchMuffler.java17
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java84
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/MTEDieselEngine.java8
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/MTEElectricBlastFurnace.java17
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/MTEExtremeDieselEngine.java8
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java8
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiFurnace.java7
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/MTEPCBFactory.java9
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchMufflerAdvanced.java17
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java13
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbineBase.java15
15 files changed, 99 insertions, 138 deletions
diff --git a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java
index 2aff0e7268..c783ef3178 100644
--- a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java
+++ b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java
@@ -23,7 +23,6 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAS
import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages;
import static gregtech.api.util.GTStructureUtility.buildHatchAdder;
import static gregtech.api.util.GTStructureUtility.ofCoil;
-import static gregtech.api.util.GTUtility.validMTEList;
import java.util.ArrayList;
import java.util.Arrays;
@@ -60,7 +59,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.logic.ProcessingLogic;
import gregtech.api.metatileentity.implementations.MTEHatch;
import gregtech.api.metatileentity.implementations.MTEHatchEnergy;
-import gregtech.api.metatileentity.implementations.MTEHatchMuffler;
import gregtech.api.metatileentity.implementations.MTEHatchOutput;
import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.RecipeMaps;
@@ -361,12 +359,7 @@ public class MTEMegaBlastFurnace extends MegaMultiBlockBase<MTEMegaBlastFurnace>
ArrayList<MTEHatchOutput> tOutputHatches;
if (isOutputPollution) {
tOutputHatches = this.mPollutionOutputHatches;
- int pollutionReduction = 0;
- for (MTEHatchMuffler tHatch : validMTEList(mMufflerHatches)) {
- pollutionReduction = 100 - tHatch.calculatePollutionReduction(100);
- break;
- }
- tLiquid.amount = tLiquid.amount * pollutionReduction / 100;
+ tLiquid.amount = tLiquid.amount * Math.min(100 - getAveragePollutionPercentage(), 100) / 100;
} else {
tOutputHatches = this.mOutputHatches;
}
diff --git a/src/main/java/bartworks/common/tileentities/multis/mega/MegaMultiBlockBase.java b/src/main/java/bartworks/common/tileentities/multis/mega/MegaMultiBlockBase.java
index 02eda50607..a164a7afd2 100644
--- a/src/main/java/bartworks/common/tileentities/multis/mega/MegaMultiBlockBase.java
+++ b/src/main/java/bartworks/common/tileentities/multis/mega/MegaMultiBlockBase.java
@@ -20,7 +20,6 @@ import gregtech.api.logic.ProcessingLogic;
import gregtech.api.metatileentity.implementations.MTEExtendedPowerMultiBlockBase;
import gregtech.api.metatileentity.implementations.MTEHatch;
import gregtech.api.metatileentity.implementations.MTEHatchEnergy;
-import gregtech.api.metatileentity.implementations.MTEHatchMuffler;
import gregtech.api.util.GTUtility;
public abstract class MegaMultiBlockBase<T extends MegaMultiBlockBase<T>> extends MTEExtendedPowerMultiBlockBase<T> {
@@ -50,12 +49,6 @@ public abstract class MegaMultiBlockBase<T extends MegaMultiBlockBase<T>> extend
@Override
public String[] getInfoData() {
- int mPollutionReduction = 0;
-
- for (MTEHatchMuffler tHatch : validMTEList(mMufflerHatches)) {
- mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction);
- }
-
long[] ttHatches = this.getCurrentInfoData();
long storedEnergy = ttHatches[0];
long maxEnergy = ttHatches[1];
@@ -124,7 +117,7 @@ public abstract class MegaMultiBlockBase<T extends MegaMultiBlockBase<T>> extend
+ " %",
StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": "
+ EnumChatFormatting.GREEN
- + mPollutionReduction
+ + getAveragePollutionPercentage()
+ EnumChatFormatting.RESET
+ " %" };
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java b/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java
index 076d8f54fd..843a42ac80 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/base/MTELargeTurbineBase.java
@@ -33,7 +33,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.items.MetaGeneratedTool;
import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase;
import gregtech.api.metatileentity.implementations.MTEHatchDynamo;
-import gregtech.api.metatileentity.implementations.MTEHatchMuffler;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.util.GTUtility;
@@ -239,11 +238,6 @@ public abstract class MTELargeTurbineBase extends MTEEnhancedMultiBlockBase<MTEL
@Override
public String[] getInfoData() {
- int mPollutionReduction = 0;
- for (MTEHatchMuffler tHatch : validMTEList(mMufflerHatches)) {
- mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction);
- }
-
String tRunning = mMaxProgresstime > 0
? EnumChatFormatting.GREEN + StatCollector.translateToLocal("GT5U.turbine.running.true")
+ EnumChatFormatting.RESET
@@ -311,7 +305,7 @@ public abstract class MTELargeTurbineBase extends MTEEnhancedMultiBlockBase<MTEL
"GT5U.turbine.dmg") + ": " + EnumChatFormatting.RED + tDura + EnumChatFormatting.RESET + "%", /* 7 */
StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": "
+ EnumChatFormatting.GREEN
- + mPollutionReduction
+ + getAveragePollutionPercentage()
+ EnumChatFormatting.RESET
+ " %" /* 8 */
};
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEExtendedPowerMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEExtendedPowerMultiBlockBase.java
index 09bfda2d0a..9ff7f34fe3 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/MTEExtendedPowerMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEExtendedPowerMultiBlockBase.java
@@ -2,7 +2,6 @@ package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GTValues.VN;
import static gregtech.api.util.GTUtility.filterValidMTEs;
-import static gregtech.api.util.GTUtility.validMTEList;
import java.util.ArrayList;
import java.util.List;
@@ -138,11 +137,6 @@ public abstract class MTEExtendedPowerMultiBlockBase<T extends MTEEnhancedMultiB
@Override
public String[] getInfoData() {
- int mPollutionReduction = 0;
- for (MTEHatchMuffler tHatch : validMTEList(mMufflerHatches)) {
- mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction);
- }
-
long storedEnergy = 0;
long maxEnergy = 0;
for (MTEHatch tHatch : getExoticAndNormalEnergyHatchList()) {
@@ -203,7 +197,7 @@ public abstract class MTEExtendedPowerMultiBlockBase<T extends MTEEnhancedMultiB
+ " %",
/* 6 */ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": "
+ EnumChatFormatting.GREEN
- + mPollutionReduction
+ + getAveragePollutionPercentage()
+ EnumChatFormatting.RESET
+ " %" };
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEHatchMuffler.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEHatchMuffler.java
index 576389de80..d1c957b976 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/MTEHatchMuffler.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEHatchMuffler.java
@@ -194,15 +194,24 @@ public class MTEHatchMuffler extends MTEHatch {
}
/**
- * @param mte The multi-block controller's {@link MetaTileEntity} MetaTileEntity is passed so newer muffler hatches
- * can do wacky things with the multis
+ * @param mte The multi-block controller's {@link MetaTileEntity} MetaTileEntity is passed so newer
+ * muffler hatches can do wacky things with the multis
+ * @param pollutionAmount How much pollution to output. Reduced by muffler efficiency.
* @return pollution success
*/
- public boolean polluteEnvironment(MetaTileEntity mte) {
+ public boolean polluteEnvironment(MetaTileEntity mte, int pollutionAmount) {
if (getBaseMetaTileEntity().getAirAtSide(getBaseMetaTileEntity().getFrontFacing())) {
- Pollution.addPollution(getBaseMetaTileEntity(), calculatePollutionReduction(10000));
+ Pollution.addPollution(getBaseMetaTileEntity(), calculatePollutionReduction(pollutionAmount));
return true;
}
return false;
}
+
+ /**
+ * @deprecated Use {@link #polluteEnvironment(MetaTileEntity, int)}.
+ */
+ @Deprecated
+ public boolean polluteEnvironment(MetaTileEntity mte) {
+ return polluteEnvironment(mte, 10000);
+ }
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java
index 0550e8da7d..1e29d797a4 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java
@@ -632,23 +632,73 @@ public abstract class MTEMultiBlockBase extends MetaTileEntity
}
public boolean polluteEnvironment(int aPollutionLevel) {
+ final int VENT_AMOUNT = 10_000;
// Early exit if pollution is disabled
if (!GTMod.gregtechproxy.mPollution) return true;
mPollution += aPollutionLevel;
- if (mPollution < 10000) return true;
- var validMufflers = new ArrayList<MTEHatchMuffler>(mMufflerHatches.size());
- validMTEList(mMufflerHatches).forEach(validMufflers::add);
- Collections.shuffle(validMufflers);
- for (MTEHatchMuffler tHatch : validMufflers) {
- if (mPollution >= 10000) {
- if (tHatch.polluteEnvironment(this)) {
- mPollution -= 10000;
- }
+ if (mPollution < VENT_AMOUNT) return true;
+ if (mMufflerHatches.size() == 0) {
+ // No muffler present. Fail.
+ return false;
+ } else if (mMufflerHatches.size() == 1) {
+ // One muffler, use simple method for performance.
+ MTEHatchMuffler muffler = mMufflerHatches.get(0);
+ if (muffler == null || !muffler.isValid()) {
+ // Muffler invalid. Fail.
+ mMufflerHatches.remove(0);
+ return false;
} else {
- break;
+ if (muffler.polluteEnvironment(this, VENT_AMOUNT)) {
+ mPollution -= VENT_AMOUNT;
+ } else {
+ // Muffler blocked. Fail.
+ return false;
+ }
}
+ } else {
+ // Multiple mufflers, split pollution output evenly between all of them.
+ int mufflerCount = 0;
+ int ventAmount = 0; // Allow venting of up to VENT_AMOUNT of pollution per muffler.
+ for (MTEHatchMuffler muffler : validMTEList(mMufflerHatches)) {
+ mufflerCount++;
+ if (ventAmount + VENT_AMOUNT <= mPollution) {
+ ventAmount += VENT_AMOUNT;
+ }
+ }
+ // This might lose some small amount of pollution due to rounding, this is fine.
+ ventAmount /= mufflerCount;
+
+ for (MTEHatchMuffler muffler : validMTEList(mMufflerHatches)) {
+ if (muffler.polluteEnvironment(this, ventAmount)) {
+ mPollution -= ventAmount;
+ } else {
+ // Muffler blocked. Fail.
+ return false;
+ }
+ }
+ }
+ return mPollution < VENT_AMOUNT;
+ }
+
+ /**
+ * How much pollution this outputs to the environment. 100 = outputs all, 0 = outputs none. Calculated as an average
+ * across all muffler hatches.
+ *
+ * @return Fraction of pollution output to the environment (out of 100).
+ */
+ public int getAveragePollutionPercentage() {
+ int pollutionPercent = 0;
+ int mufflerCount = 0;
+ for (MTEHatchMuffler muffler : validMTEList(mMufflerHatches)) {
+ pollutionPercent += muffler.calculatePollutionReduction(100);
+ mufflerCount++;
+ }
+ if (mufflerCount > 0) {
+ pollutionPercent /= mufflerCount;
+ } else {
+ pollutionPercent = 100;
}
- return mPollution < 10000;
+ return pollutionPercent;
}
protected void sendStartMultiBlockSoundLoop() {
@@ -1826,16 +1876,6 @@ public abstract class MTEMultiBlockBase extends MetaTileEntity
@Override
public String[] getInfoData() {
- int mPollutionReduction = 0;
- var validMufflers = new ArrayList<MTEHatchMuffler>(mMufflerHatches.size());
- validMTEList(mMufflerHatches).forEach(validMufflers::add);
- if (validMufflers.size() > 0) {
- for (MTEHatchMuffler tHatch : validMufflers) {
- mPollutionReduction += tHatch.calculatePollutionReduction(100);
- }
- mPollutionReduction /= validMufflers.size();
- }
-
long storedEnergy = 0;
long maxEnergy = 0;
for (MTEHatchEnergy tHatch : validMTEList(mEnergyHatches)) {
@@ -1891,7 +1931,7 @@ public abstract class MTEMultiBlockBase extends MetaTileEntity
+ " %",
/* 6 */ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": "
+ EnumChatFormatting.GREEN
- + mPollutionReduction
+ + getAveragePollutionPercentage()
+ EnumChatFormatting.RESET
+ " %" };
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEDieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEDieselEngine.java
index 0003c98876..e0ee2c144b 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEDieselEngine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEDieselEngine.java
@@ -40,7 +40,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase;
import gregtech.api.metatileentity.implementations.MTEHatchDynamo;
-import gregtech.api.metatileentity.implementations.MTEHatchMuffler;
import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.RecipeMaps;
import gregtech.api.recipe.check.CheckRecipeResult;
@@ -334,11 +333,6 @@ public class MTEDieselEngine extends MTEEnhancedMultiBlockBase<MTEDieselEngine>
@Override
public String[] getInfoData() {
- int mPollutionReduction = 0;
- for (MTEHatchMuffler tHatch : validMTEList(mMufflerHatches)) {
- mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction);
- }
-
long storedEnergy = 0;
long maxEnergy = 0;
for (MTEHatchDynamo tHatch : validMTEList(mDynamoHatches)) {
@@ -390,7 +384,7 @@ public class MTEDieselEngine extends MTEEnhancedMultiBlockBase<MTEDieselEngine>
+ " %",
StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": "
+ EnumChatFormatting.GREEN
- + mPollutionReduction
+ + getAveragePollutionPercentage()
+ EnumChatFormatting.RESET
+ " %" };
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEElectricBlastFurnace.java
index cc62dd11de..551efca684 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEElectricBlastFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEElectricBlastFurnace.java
@@ -53,7 +53,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.logic.ProcessingLogic;
import gregtech.api.metatileentity.implementations.MTEHatch;
import gregtech.api.metatileentity.implementations.MTEHatchEnergy;
-import gregtech.api.metatileentity.implementations.MTEHatchMuffler;
import gregtech.api.metatileentity.implementations.MTEHatchOutput;
import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.RecipeMaps;
@@ -270,24 +269,12 @@ public class MTEElectricBlastFurnace extends MTEAbstractMultiFurnace<MTEElectric
return filterValidMTEs(mOutputHatches);
}
- /**
- * @return 100 -> all released to air, 0 -> all dumped to hatch
- */
- public int getPollutionReduction() {
- int reduction = 100;
- for (MTEHatchMuffler tHatch : validMTEList(mMufflerHatches)) {
- reduction = Math.min(tHatch.calculatePollutionReduction(100), reduction);
- }
- return reduction;
- }
-
protected void multiplyPollutionFluidAmount(@Nonnull FluidStack fluid) {
- fluid.amount = fluid.amount * Math.min(100 - getPollutionReduction(), 100) / 100;
+ fluid.amount = fluid.amount * Math.min(100 - getAveragePollutionPercentage(), 100) / 100;
}
@Override
public String[] getInfoData() {
- int mPollutionReduction = getPollutionReduction();
long storedEnergy = 0;
long maxEnergy = 0;
for (MTEHatchEnergy tHatch : validMTEList(mEnergyHatches)) {
@@ -349,7 +336,7 @@ public class MTEElectricBlastFurnace extends MTEAbstractMultiFurnace<MTEElectric
+ " K",
StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": "
+ EnumChatFormatting.GREEN
- + mPollutionReduction
+ + getAveragePollutionPercentage()
+ EnumChatFormatting.RESET
+ " %" };
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEExtremeDieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEExtremeDieselEngine.java
index d0ed92d0fc..8c708dacca 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEExtremeDieselEngine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEExtremeDieselEngine.java
@@ -20,7 +20,6 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.MTEHatchDynamo;
-import gregtech.api.metatileentity.implementations.MTEHatchMuffler;
import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.RecipeMaps;
import gregtech.api.recipe.maps.FuelBackend;
@@ -172,11 +171,6 @@ public class MTEExtremeDieselEngine extends MTEDieselEngine {
@Override
public String[] getInfoData() {
- int mPollutionReduction = 0;
- for (MTEHatchMuffler tHatch : validMTEList(mMufflerHatches)) {
- mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction);
- }
-
long storedEnergy = 0;
long maxEnergy = 0;
for (MTEHatchDynamo tHatch : validMTEList(mDynamoHatches)) {
@@ -228,7 +222,7 @@ public class MTEExtremeDieselEngine extends MTEDieselEngine {
+ " %",
StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": "
+ EnumChatFormatting.GREEN
- + mPollutionReduction
+ + getAveragePollutionPercentage()
+ EnumChatFormatting.RESET
+ " %" };
}
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 ffea5e40f6..c9c643de8c 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java
@@ -50,7 +50,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.items.MetaGeneratedTool;
import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase;
import gregtech.api.metatileentity.implementations.MTEHatchDynamo;
-import gregtech.api.metatileentity.implementations.MTEHatchMuffler;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.util.GTUtility;
@@ -365,11 +364,6 @@ public abstract class MTELargeTurbine extends MTEEnhancedMultiBlockBase<MTELarge
@Override
public String[] getInfoData() {
- int mPollutionReduction = 0;
- for (MTEHatchMuffler tHatch : validMTEList(mMufflerHatches)) {
- mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction);
- }
-
String tRunning = mMaxProgresstime > 0
? EnumChatFormatting.GREEN + StatCollector.translateToLocal("GT5U.turbine.running.true")
+ EnumChatFormatting.RESET
@@ -437,7 +431,7 @@ public abstract class MTELargeTurbine extends MTEEnhancedMultiBlockBase<MTELarge
"GT5U.turbine.dmg") + ": " + EnumChatFormatting.RED + tDura + EnumChatFormatting.RESET + "%", /* 7 */
StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": "
+ EnumChatFormatting.GREEN
- + mPollutionReduction
+ + getAveragePollutionPercentage()
+ EnumChatFormatting.RESET
+ " %" /* 8 */
};
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiFurnace.java
index 4d5e1ea3cd..7227e022e5 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiFurnace.java
@@ -38,7 +38,6 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.MTEHatchEnergy;
-import gregtech.api.metatileentity.implementations.MTEHatchMuffler;
import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.RecipeMaps;
import gregtech.api.recipe.check.CheckRecipeResult;
@@ -281,10 +280,6 @@ public class MTEMultiFurnace extends MTEAbstractMultiFurnace<MTEMultiFurnace> im
@Override
public String[] getInfoData() {
- int mPollutionReduction = 0;
- for (final MTEHatchMuffler tHatch : validMTEList(mMufflerHatches))
- mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction);
-
long storedEnergy = 0;
long maxEnergy = 0;
for (final MTEHatchEnergy tHatch : validMTEList(mEnergyHatches)) {
@@ -349,7 +344,7 @@ public class MTEMultiFurnace extends MTEAbstractMultiFurnace<MTEMultiFurnace> im
+ EnumChatFormatting.RESET,
StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": "
+ EnumChatFormatting.GREEN
- + mPollutionReduction
+ + getAveragePollutionPercentage()
+ EnumChatFormatting.RESET
+ " %" };
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEPCBFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEPCBFactory.java
index 603f66c734..a817464b50 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEPCBFactory.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEPCBFactory.java
@@ -16,7 +16,6 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_GLOW;
import static gregtech.api.util.GTStructureUtility.buildHatchAdder;
import static gregtech.api.util.GTStructureUtility.ofFrame;
-import static gregtech.api.util.GTUtility.validMTEList;
import java.util.ArrayList;
import java.util.List;
@@ -73,7 +72,6 @@ import gregtech.api.metatileentity.GregTechTileClientEvents;
import gregtech.api.metatileentity.implementations.MTEExtendedPowerMultiBlockBase;
import gregtech.api.metatileentity.implementations.MTEHatch;
import gregtech.api.metatileentity.implementations.MTEHatchInput;
-import gregtech.api.metatileentity.implementations.MTEHatchMuffler;
import gregtech.api.multitileentity.multiblock.casing.Glasses;
import gregtech.api.objects.ItemData;
import gregtech.api.recipe.RecipeMap;
@@ -763,11 +761,6 @@ public class MTEPCBFactory extends MTEExtendedPowerMultiBlockBase<MTEPCBFactory>
@Override
public String[] getInfoData() {
- int mPollutionReduction = 0;
- for (MTEHatchMuffler tHatch : validMTEList(mMufflerHatches)) {
- mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction);
- }
-
long storedEnergy = 0;
long maxEnergy = 0;
for (MTEHatch tHatch : getExoticAndNormalEnergyHatchList()) {
@@ -828,7 +821,7 @@ public class MTEPCBFactory extends MTEExtendedPowerMultiBlockBase<MTEPCBFactory>
+ " %",
/* 6 */ StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": "
+ EnumChatFormatting.GREEN
- + mPollutionReduction
+ + getAveragePollutionPercentage()
+ EnumChatFormatting.RESET
+ " %",
/* 7 */ StatCollector.translateToLocal("GT5U.multiblock.parallelism") + ": "
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchMufflerAdvanced.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchMufflerAdvanced.java
index 5919a71b25..40e804bf36 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchMufflerAdvanced.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/MTEHatchMufflerAdvanced.java
@@ -84,18 +84,21 @@ public class MTEHatchMufflerAdvanced extends MTEHatchMuffler implements IAddGreg
}
@Override
- public boolean polluteEnvironment(MetaTileEntity parentTileEntity) {
+ public boolean polluteEnvironment(MetaTileEntity parentTileEntity, int pollutionAmount) {
if (!airCheck()) return false; // Muffler obstructed.
-
- int emission = 10000;
- if (damageAirFilter(parentTileEntity)) {
+ if (pollutionAmount < 10000 && pollutionAmount <= parentTileEntity.getBaseMetaTileEntity()
+ .getRandomNumber(10000)) {
+ // If we are venting less than the maximum amount of pollution, damage filter with a lower chance.
+ // This happens if a multiblock has more than one muffler.
+ pollutionAmount = calculatePollutionReduction(pollutionAmount, true);
+ } else if (damageAirFilter(parentTileEntity)) {
// damageAirFilter already checks that we have a valid filter.
- emission = calculatePollutionReduction(emission, true);
+ pollutionAmount = calculatePollutionReduction(pollutionAmount, true);
} else {
// Revert to reduction of the basic muffler.
- emission = super.calculatePollutionReduction(emission);
+ pollutionAmount = super.calculatePollutionReduction(pollutionAmount);
}
- Pollution.addPollution(getBaseMetaTileEntity(), emission);
+ Pollution.addPollution(getBaseMetaTileEntity(), pollutionAmount);
return true;
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java
index df55649bb5..9b5448ac49 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java
@@ -240,7 +240,6 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas
+ " %");
if (this.getPollutionPerSecond(null) > 0) {
- int mPollutionReduction = getPollutionReductionForAllMufflers();
mInfo.add(
StatCollector.translateToLocal("GTPP.multiblock.pollution") + ": "
+ EnumChatFormatting.RED
@@ -250,7 +249,7 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas
mInfo.add(
StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced") + ": "
+ EnumChatFormatting.GREEN
- + mPollutionReduction
+ + getAveragePollutionPercentage()
+ EnumChatFormatting.RESET
+ " %");
}
@@ -287,14 +286,6 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas
return mInfo.toArray(new String[0]);
}
- public int getPollutionReductionForAllMufflers() {
- int mPollutionReduction = 0;
- for (MTEHatchMuffler tHatch : validMTEList(mMufflerHatches)) {
- mPollutionReduction = Math.max(calculatePollutionReductionForHatch(tHatch, 100), mPollutionReduction);
- }
- return mPollutionReduction;
- }
-
public long getStoredEnergyInAllEnergyHatches() {
long storedEnergy = 0;
for (MTEHatch tHatch : validMTEList(mAllEnergyHatches)) {
@@ -1404,7 +1395,7 @@ public abstract class GTPPMultiBlockBase<T extends MTEExtendedPowerMultiBlockBas
.dynamicString(
() -> StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced") + ": "
+ EnumChatFormatting.GREEN
- + getPollutionReductionForAllMufflers()
+ + getAveragePollutionPercentage()
+ EnumChatFormatting.RESET
+ " %")
.setDefaultColor(COLOR_TEXT_WHITE.get())
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbineBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbineBase.java
index 1623346299..e96493351e 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbineBase.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbineBase.java
@@ -41,7 +41,6 @@ import gregtech.api.items.MetaGeneratedTool;
import gregtech.api.metatileentity.implementations.MTEHatch;
import gregtech.api.metatileentity.implementations.MTEHatchDynamo;
import gregtech.api.metatileentity.implementations.MTEHatchInputBus;
-import gregtech.api.metatileentity.implementations.MTEHatchMuffler;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.util.GTUtility;
@@ -120,7 +119,6 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT
protected int storedFluid = 0;
protected int counter = 0;
protected boolean looseFit = false;
- protected double mufflerReduction = 1;
protected float[] flowMultipliers = new float[] { 1, 1, 1 };
public ITexture frontFace = new GTPPRenderedTexture(TexturesGtBlock.Overlay_Machine_Controller_Advanced);
@@ -188,14 +186,6 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT
return getPollutionPerSecond(null) > 0;
}
- public final double getMufflerReduction() {
- double totalReduction = 0;
- for (MTEHatchMuffler tHatch : validMTEList(mMufflerHatches)) {
- totalReduction += ((double) tHatch.calculatePollutionReduction(100)) / 100;
- }
- return totalReduction / 4;
- }
-
@Override
public void clearHatches() {
super.clearHatches();
@@ -229,7 +219,6 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT
+ mOutputHatches.size());
return false;
}
- mufflerReduction = getMufflerReduction();
return aStructure;
}
@@ -559,8 +548,6 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT
@Override
public String[] getExtraInfoData() {
- int mPollutionReduction = (int) (100 * mufflerReduction);
-
String tRunning = mMaxProgresstime > 0
? EnumChatFormatting.GREEN + StatCollector.translateToLocal("GT5U.turbine.running.true")
+ EnumChatFormatting.RESET
@@ -640,7 +627,7 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT
StatCollector.translateToLocal("GT5U.turbine.dmg") + ": " + aTurbineDamage,
StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": "
+ EnumChatFormatting.GREEN
- + GTUtility.formatNumbers(mPollutionReduction)
+ + getAveragePollutionPercentage()
+ EnumChatFormatting.RESET
+ " %" };
}