diff options
author | Abdiel Kavash <19243993+AbdielKavash@users.noreply.github.com> | 2024-11-20 11:08:11 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 18:08:11 +0100 |
commit | 36acbb9baed7dae4e19fde7a95852b7d002b2f5c (patch) | |
tree | 373ef20415a65c444a214a5398b6c550cfc2b5df /src/main/java/gtPlusPlus/xmod/gregtech/api | |
parent | 4ecb0005608fb5774dee56eb751c850d862fa98d (diff) | |
download | GT5-Unofficial-36acbb9baed7dae4e19fde7a95852b7d002b2f5c.tar.gz GT5-Unofficial-36acbb9baed7dae4e19fde7a95852b7d002b2f5c.tar.bz2 GT5-Unofficial-36acbb9baed7dae4e19fde7a95852b7d002b2f5c.zip |
Follow up fixes for multiple muffler hatches. (#3505)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api')
2 files changed, 12 insertions, 18 deletions
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()) |