aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/metatileentity
diff options
context:
space:
mode:
authornshepperd <nshepperd@gmail.com>2024-11-15 02:06:06 +1100
committerGitHub <noreply@github.com>2024-11-14 15:06:06 +0000
commit8ee08dfde1a4cca3068106cfeca19073c903653f (patch)
tree19d6b340b6ffbf3727e7028d8015d04d45c61648 /src/main/java/gregtech/api/metatileentity
parent78d61f626328702d1b6c9b937f84e2aa4119b009 (diff)
downloadGT5-Unofficial-8ee08dfde1a4cca3068106cfeca19073c903653f.tar.gz
GT5-Unofficial-8ee08dfde1a4cca3068106cfeca19073c903653f.tar.bz2
GT5-Unofficial-8ee08dfde1a4cca3068106cfeca19073c903653f.zip
Fix advanced mufflers in the XLGT and other multiblocks with >1 muffler hatch (#3489)
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity')
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java
index d250943a23..5b29f886f0 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java
@@ -635,7 +635,11 @@ public abstract class MTEMultiBlockBase extends MetaTileEntity
// Early exit if pollution is disabled
if (!GTMod.gregtechproxy.mPollution) return true;
mPollution += aPollutionLevel;
- for (MTEHatchMuffler tHatch : validMTEList(mMufflerHatches)) {
+ 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;
@@ -1823,8 +1827,13 @@ public abstract class MTEMultiBlockBase extends MetaTileEntity
@Override
public String[] getInfoData() {
int mPollutionReduction = 0;
- for (MTEHatchMuffler tHatch : validMTEList(mMufflerHatches)) {
- mPollutionReduction = Math.max(tHatch.calculatePollutionReduction(100), mPollutionReduction);
+ 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;