diff options
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common')
9 files changed, 79 insertions, 138 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java index da6dcc4b28..b8d5ebdf8b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java @@ -12,6 +12,7 @@ import static gregtech.api.enums.GT_HatchElement.Muffler; import static gregtech.api.enums.GT_HatchElement.OutputBus; import static gregtech.api.enums.GT_HatchElement.OutputHatch; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_Utility.filterValidMTEs; import java.util.ArrayList; @@ -157,8 +158,7 @@ public class GregtechMetaTileEntity_IndustrialVacuumFreezer extends @Override public void updateSlots() { - for (GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : mCryotheumHatches) - if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); + for (GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : filterValidMTEs(mCryotheumHatches)) tHatch.updateSlots(); super.updateSlots(); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java index 23889df16e..f8f8a28ccc 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java @@ -12,6 +12,7 @@ import static gregtech.api.enums.GT_HatchElement.Muffler; import static gregtech.api.enums.GT_HatchElement.OutputBus; import static gregtech.api.enums.GT_HatchElement.OutputHatch; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_Utility.filterValidMTEs; import java.util.ArrayList; import java.util.HashSet; @@ -428,11 +429,9 @@ public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase< @Override public ArrayList<ItemStack> getStoredInputs() { ArrayList<ItemStack> tItems = super.getStoredInputs(); - for (GT_MetaTileEntity_Hatch_MillingBalls tHatch : mMillingBallBuses) { + for (GT_MetaTileEntity_Hatch_MillingBalls tHatch : filterValidMTEs(mMillingBallBuses)) { tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - tItems.addAll(tHatch.getContentUsageSlots()); - } + tItems.addAll(tHatch.getContentUsageSlots()); } return tItems; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java index a17b1c70c1..f951927434 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java @@ -13,6 +13,7 @@ import static gregtech.api.enums.GT_HatchElement.OutputBus; import static gregtech.api.enums.GT_HatchElement.OutputHatch; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; import static gregtech.api.util.GT_StructureUtility.ofCoil; +import static gregtech.api.util.GT_Utility.filterValidMTEs; import java.util.ArrayList; @@ -23,7 +24,6 @@ import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; import org.jetbrains.annotations.NotNull; @@ -179,28 +179,10 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase< @Override public void updateSlots() { - for (GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : mPyrotheumHatches) - if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); + for (GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : filterValidMTEs(mPyrotheumHatches)) tHatch.updateSlots(); super.updateSlots(); } - private boolean depleteFuel(int aAmount) { - for (final GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : this.mPyrotheumHatches) { - if (isValidMetaTileEntity(tHatch)) { - FluidStack tLiquid = tHatch.getFluid(); - if (tLiquid == null || tLiquid.amount < aAmount) { - continue; - } - tLiquid = tHatch.drain(aAmount, false); - if (tLiquid != null && tLiquid.amount >= aAmount) { - tLiquid = tHatch.drain(aAmount, true); - return tLiquid != null && tLiquid.amount >= aAmount; - } - } - } - return false; - } - @Override protected IIconContainer getActiveOverlay() { return TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java index 2f0bcc2c4f..4063c967d7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java @@ -11,6 +11,7 @@ import static gregtech.api.enums.GT_HatchElement.Muffler; import static gregtech.api.enums.GT_HatchElement.OutputBus; import static gregtech.api.enums.GT_HatchElement.OutputHatch; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_Utility.filterValidMTEs; import java.util.ArrayList; import java.util.Collection; @@ -376,11 +377,9 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase @Override public ArrayList<ItemStack> getStoredInputs() { ArrayList<ItemStack> tItems = super.getStoredInputs(); - for (GT_MetaTileEntity_Hatch_ElementalDataOrbHolder tHatch : mReplicatorDataOrbHatches) { + for (GT_MetaTileEntity_Hatch_ElementalDataOrbHolder tHatch : filterValidMTEs(mReplicatorDataOrbHatches)) { tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - tItems.add(tHatch.getOrbByCircuit()); - } + tItems.add(tHatch.getOrbByCircuit()); } tItems.removeAll(Collections.singleton(null)); return tItems; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java index 74a51a0260..143fedb5a5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java @@ -9,6 +9,7 @@ import static gregtech.api.enums.GT_HatchElement.InputHatch; import static gregtech.api.enums.GT_HatchElement.Maintenance; import static gregtech.api.enums.GT_HatchElement.Muffler; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_Utility.filterValidMTEs; import static gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase.GTPPHatchElement.AirIntake; import static gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase.GTPPHatchElement.TTDynamo; @@ -384,31 +385,18 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends long totalOutput = 0; long aFirstVoltageFound = -1; boolean aFoundMixedDynamos = false; - for (GT_MetaTileEntity_Hatch aDynamo : this.mAllDynamoHatches) { - if (aDynamo == null) { - return false; - } - if (isValidMetaTileEntity(aDynamo)) { - long aVoltage = aDynamo.maxEUOutput(); - long aTotal = aDynamo.maxAmperesOut() * aVoltage; - // Check against voltage to check when hatch mixing - if (aFirstVoltageFound == -1) { - aFirstVoltageFound = aVoltage; - } else { - /** - * Calcualtes overclocked ness using long integers - * - * @param aEUt - recipe EUt - * @param aDuration - recipe Duration - * @param mAmperage - should be 1 ? - */ - // Long time calculation - if (aFirstVoltageFound != aVoltage) { - aFoundMixedDynamos = true; - } + for (GT_MetaTileEntity_Hatch aDynamo : filterValidMTEs(this.mAllDynamoHatches)) { + long aVoltage = aDynamo.maxEUOutput(); + long aTotal = aDynamo.maxAmperesOut() * aVoltage; + // Check against voltage to check when hatch mixing + if (aFirstVoltageFound == -1) { + aFirstVoltageFound = aVoltage; + } else { + if (aFirstVoltageFound != aVoltage) { + aFoundMixedDynamos = true; } - totalOutput += aTotal; } + totalOutput += aTotal; } if (totalOutput < aEU || (aFoundMixedDynamos && !aAllowMixedVoltageDynamos)) { @@ -417,29 +405,24 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends } long leftToInject; - // Long EUt calculation long aVoltage; - // Isnt too low EUt check? int aAmpsToInject; int aRemainder; - // xEUt *= 4;//this is effect of everclocking - for (GT_MetaTileEntity_Hatch aDynamo : this.mAllDynamoHatches) { - if (isValidMetaTileEntity(aDynamo)) { - leftToInject = aEU - injected; - aVoltage = aDynamo.maxEUOutput(); - aAmpsToInject = (int) (leftToInject / aVoltage); - aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage)); - long powerGain; - for (int i = 0; i < Math.min(aDynamo.maxAmperesOut(), aAmpsToInject + 1); i++) { - if (i == Math.min(aDynamo.maxAmperesOut(), aAmpsToInject)) { - powerGain = aRemainder; - } else { - powerGain = aVoltage; - } - aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(powerGain, false); - injected += powerGain; + for (GT_MetaTileEntity_Hatch aDynamo : filterValidMTEs(this.mAllDynamoHatches)) { + leftToInject = aEU - injected; + aVoltage = aDynamo.maxEUOutput(); + aAmpsToInject = (int) (leftToInject / aVoltage); + aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage)); + long powerGain; + for (int i = 0; i < Math.min(aDynamo.maxAmperesOut(), aAmpsToInject + 1); i++) { + if (i == Math.min(aDynamo.maxAmperesOut(), aAmpsToInject)) { + powerGain = aRemainder; + } else { + powerGain = aVoltage; } + aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(powerGain, false); + injected += powerGain; } } return injected > 0; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java index d06566213a..01454f5b91 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java @@ -11,6 +11,7 @@ import static gregtech.api.enums.GT_HatchElement.OutputHatch; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; import static gregtech.api.util.GT_StructureUtility.filterByMTETier; import static gregtech.api.util.GT_StructureUtility.ofCoil; +import static gregtech.api.util.GT_Utility.filterValidMTEs; import java.util.ArrayList; import java.util.HashMap; @@ -688,13 +689,11 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt if (this.getControllerSlot() != null) { tItems.add(this.getControllerSlot()); } - for (GT_MetaTileEntity_Hatch_Catalysts tHatch : mCatalystBuses) { + for (GT_MetaTileEntity_Hatch_Catalysts tHatch : filterValidMTEs(mCatalystBuses)) { tHatch.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tHatch)) { - AutoMap<ItemStack> aHatchContent = tHatch.getContentUsageSlots(); - if (!aHatchContent.isEmpty()) { - tItems.addAll(aHatchContent); - } + AutoMap<ItemStack> aHatchContent = tHatch.getContentUsageSlots(); + if (!aHatchContent.isEmpty()) { + tItems.addAll(aHatchContent); } } return tItems; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/mega/GregTechMetaTileEntity_MegaAlloyBlastSmelter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/mega/GregTechMetaTileEntity_MegaAlloyBlastSmelter.java index edf3adf40b..e327e2111e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/mega/GregTechMetaTileEntity_MegaAlloyBlastSmelter.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/mega/GregTechMetaTileEntity_MegaAlloyBlastSmelter.java @@ -14,6 +14,7 @@ import static gregtech.api.enums.GT_HatchElement.OutputBus; import static gregtech.api.enums.GT_HatchElement.OutputHatch; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; import static gregtech.api.util.GT_StructureUtility.ofCoil; +import static gregtech.api.util.GT_Utility.filterValidMTEs; import java.util.ArrayList; import java.util.List; @@ -313,11 +314,9 @@ public class GregTechMetaTileEntity_MegaAlloyBlastSmelter int paras = getBaseMetaTileEntity().isActive() ? processingLogic.getCurrentParallels() : 0; int discountP = (int) (getCoilDiscount(coilLevel) * 1000) / 10; - for (GT_MetaTileEntity_Hatch tHatch : mExoticEnergyHatches) { - if (isValidMetaTileEntity(tHatch)) { - storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); - } + for (GT_MetaTileEntity_Hatch tHatch : filterValidMTEs(mExoticEnergyHatches)) { + storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } return new String[] { "------------ Critical Information ------------", 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 fce6ec4408..389e267545 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 @@ -9,6 +9,7 @@ import static gregtech.api.enums.GT_HatchElement.Maintenance; import static gregtech.api.enums.GT_HatchElement.Muffler; import static gregtech.api.enums.GT_HatchElement.OutputHatch; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import static gregtech.api.util.GT_Utility.filterValidMTEs; import static gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase.GTPPHatchElement.TTDynamo; import java.util.ArrayList; @@ -196,10 +197,8 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends public final double getMufflerReduction() { double totalReduction = 0; - for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { - if (isValidMetaTileEntity(tHatch)) { - totalReduction += ((double) tHatch.calculatePollutionReduction(100)) / 100; - } + for (GT_MetaTileEntity_Hatch_Muffler tHatch : filterValidMTEs(mMufflerHatches)) { + totalReduction += ((double) tHatch.calculatePollutionReduction(100)) / 100; } return totalReduction / 4; } @@ -610,11 +609,9 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends long storedEnergy = 0; long maxEnergy = 0; - for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { - if (isValidMetaTileEntity(tHatch)) { - storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); - } + for (GT_MetaTileEntity_Hatch_Dynamo tHatch : filterValidMTEs(mDynamoHatches)) { + storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } boolean aIsSteam = this.getClass().getName().toLowerCase().contains("steam"); @@ -679,15 +676,13 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends public boolean polluteEnvironment(int aPollutionLevel) { if (this.requiresMufflers()) { mPollution += aPollutionLevel * getPollutionMultiplier() * mufflerReduction; - for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (mPollution >= 10000) { - if (PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10000)) { - mPollution -= 10000; - } - } else { - break; + for (GT_MetaTileEntity_Hatch_Muffler tHatch : filterValidMTEs(mMufflerHatches)) { + if (mPollution >= 10000) { + if (PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10000)) { + mPollution -= 10000; } + } else { + break; } } return mPollution < 10000; @@ -793,8 +788,7 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends if (this.mTurbineRotorHatches.isEmpty() || ((System.currentTimeMillis() / 1000) - mLastHatchUpdate) <= 2) { return; } - for (GT_MetaTileEntity_Hatch_Turbine h : this.mTurbineRotorHatches) { - if (!isValidMetaTileEntity(h)) continue; + for (GT_MetaTileEntity_Hatch_Turbine h : filterValidMTEs(this.mTurbineRotorHatches)) { h.setActive(aState); } @@ -833,16 +827,11 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends public boolean addEnergyOutputMultipleDynamos(long aEU, boolean aAllowMixedVoltageDynamos) { int injected = 0; long aFirstVoltageFound = -1; - for (GT_MetaTileEntity_Hatch aDynamo : mAllDynamoHatches) { - if (aDynamo == null) { - return false; - } - if (isValidMetaTileEntity(aDynamo)) { - long aVoltage = aDynamo.maxEUOutput(); - // Check against voltage to check when hatch mixing - if (aFirstVoltageFound == -1) { - aFirstVoltageFound = aVoltage; - } + for (GT_MetaTileEntity_Hatch aDynamo : filterValidMTEs(mAllDynamoHatches)) { + long aVoltage = aDynamo.maxEUOutput(); + // Check against voltage to check when hatch mixing + if (aFirstVoltageFound == -1) { + aFirstVoltageFound = aVoltage; } } @@ -851,21 +840,19 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends int aAmpsToInject; int aRemainder; int ampsOnCurrentHatch; - for (GT_MetaTileEntity_Hatch aDynamo : mAllDynamoHatches) { - if (isValidMetaTileEntity(aDynamo)) { - leftToInject = aEU - injected; - aVoltage = aDynamo.maxEUOutput(); - aAmpsToInject = (int) (leftToInject / aVoltage); - aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage)); - ampsOnCurrentHatch = (int) Math.min(aDynamo.maxAmperesOut(), aAmpsToInject); - for (int i = 0; i < ampsOnCurrentHatch; i++) { - aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aVoltage, false); - } - injected += aVoltage * ampsOnCurrentHatch; - if (aRemainder > 0 && ampsOnCurrentHatch < aDynamo.maxAmperesOut()) { - aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aRemainder, false); - injected += aRemainder; - } + for (GT_MetaTileEntity_Hatch aDynamo : filterValidMTEs(mAllDynamoHatches)) { + leftToInject = aEU - injected; + aVoltage = aDynamo.maxEUOutput(); + aAmpsToInject = (int) (leftToInject / aVoltage); + aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage)); + ampsOnCurrentHatch = (int) Math.min(aDynamo.maxAmperesOut(), aAmpsToInject); + for (int i = 0; i < ampsOnCurrentHatch; i++) { + aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aVoltage, false); + } + injected += aVoltage * ampsOnCurrentHatch; + if (aRemainder > 0 && ampsOnCurrentHatch < aDynamo.maxAmperesOut()) { + aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aRemainder, false); + injected += aRemainder; } } return injected > 0; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java index 8e7f2b97ed..175d2be7a2 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java @@ -12,6 +12,7 @@ import static gregtech.api.enums.GT_HatchElement.Maintenance; import static gregtech.api.enums.Mods.TecTech; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; +import static gregtech.api.util.GT_Utility.filterValidMTEs; import static gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase.GTPPHatchElement.TTDynamo; import static gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase.GTPPHatchElement.TTEnergy; @@ -569,10 +570,6 @@ public class GregtechMetaTileEntity_PowerSubStationController } private long drawEnergyFromHatch(MetaTileEntity aHatch) { - if (!isValidMetaTileEntity(aHatch)) { - return 0; - } - long stored = aHatch.getEUVar(); long voltage = aHatch.maxEUInput() * aHatch.maxAmperesIn(); @@ -589,10 +586,6 @@ public class GregtechMetaTileEntity_PowerSubStationController } private long addEnergyToHatch(MetaTileEntity aHatch) { - if (!isValidMetaTileEntity(aHatch)) { - return 0; - } - long voltage = aHatch.maxEUOutput() * aHatch.maxAmperesOut(); if (aHatch.getEUVar() > aHatch.maxEUStore() - voltage) { @@ -638,18 +631,18 @@ public class GregtechMetaTileEntity_PowerSubStationController long aInputAverage = 0; long aOutputAverage = 0; // Input Power - for (GT_MetaTileEntity_Hatch THatch : this.mDischargeHatches) { + for (GT_MetaTileEntity_Hatch THatch : filterValidMTEs(this.mDischargeHatches)) { aInputAverage += drawEnergyFromHatch(THatch); } - for (GT_MetaTileEntity_Hatch tHatch : this.mAllEnergyHatches) { + for (GT_MetaTileEntity_Hatch tHatch : filterValidMTEs(this.mAllEnergyHatches)) { aInputAverage += drawEnergyFromHatch(tHatch); } // Output Power - for (GT_MetaTileEntity_Hatch THatch : this.mChargeHatches) { + for (GT_MetaTileEntity_Hatch THatch : filterValidMTEs(this.mChargeHatches)) { aOutputAverage += addEnergyToHatch(THatch); } - for (GT_MetaTileEntity_Hatch tHatch : this.mAllDynamoHatches) { + for (GT_MetaTileEntity_Hatch tHatch : filterValidMTEs(this.mAllDynamoHatches)) { aOutputAverage += addEnergyToHatch(tHatch); } // reset progress time |