aboutsummaryrefslogtreecommitdiff
path: root/src/main
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
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')
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java15
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbineBase.java24
2 files changed, 12 insertions, 27 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;
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 fa3e43d8d4..1623346299 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
@@ -49,7 +49,6 @@ import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.api.util.TurbineStatCalculator;
import gregtech.api.util.shutdown.ShutDownReason;
import gregtech.api.util.shutdown.ShutDownReasonRegistry;
-import gregtech.common.pollution.Pollution;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.minecraft.BlockPos;
import gtPlusPlus.core.block.ModBlocks;
@@ -652,25 +651,6 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT
}
@Override
- public boolean polluteEnvironment(int aPollutionLevel) {
- if (this.requiresMufflers()) {
- mPollution += aPollutionLevel * getPollutionMultiplier() * mufflerReduction;
- for (MTEHatchMuffler tHatch : validMTEList(mMufflerHatches)) {
- if (mPollution >= 10000) {
- if (GTMod.gregtechproxy.mPollution) {
- Pollution.addPollution(this.getBaseMetaTileEntity(), 10000);
- mPollution -= 10000;
- }
- } else {
- break;
- }
- }
- return mPollution < 10000;
- }
- return true;
- }
-
- @Override
public long maxAmperesOut() {
return 16;
}
@@ -842,10 +822,6 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT
return 1;
}
- public int getPollutionMultiplier() {
- return 1;
- }
-
public int getTurbineDamageMultiplier() {
return 1;
}