From 3b9bd1188e932e6bb8041f7bb9afbf3ce75e26d3 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Wed, 2 Oct 2024 07:31:08 +0200 Subject: Cleanup the codebase (#3311) Co-authored-by: boubou19 --- .../tileentities/casings/upgrade/Inventory.java | 2 +- .../common/tileentities/casings/upgrade/Tank.java | 4 ++-- .../generators/MTEMagicalEnergyAbsorber.java | 10 ++++---- .../generators/MTENaquadahReactor.java | 2 +- .../tileentities/generators/MTESteamTurbine.java | 1 - .../tileentities/machines/IDualInputHatch.java | 2 +- .../tileentities/machines/ISmartInputHatch.java | 2 +- .../machines/MTEHatchCraftingInputME.java | 14 +++++------ .../tileentities/machines/MTEHatchOutputBusME.java | 5 +--- .../tileentities/machines/MTEHatchOutputME.java | 5 +--- .../tileentities/machines/basic/MTEPump.java | 4 ++-- .../machines/basic/MTETurboCharger.java | 6 ++--- .../machines/basic/MTEWorldAccelerator.java | 10 ++++---- .../long_distance/MTELongDistancePipelineBase.java | 10 ++++---- .../MTELongDistancePipelineFluid.java | 10 ++++---- .../long_distance/MTELongDistancePipelineItem.java | 10 ++++---- .../MTEIndustrialElectromagneticSeparator.java | 4 ++-- .../machines/multi/MTEIndustrialLaserEngraver.java | 5 +--- .../machines/multi/MTELargeFluidExtractor.java | 11 ++++----- .../machines/multi/MTELargeTurbine.java | 3 +-- .../machines/multi/MTELargeTurbineGas.java | 2 +- .../machines/multi/MTELargeTurbineGasAdvanced.java | 2 +- .../machines/multi/MTELargeTurbinePlasma.java | 2 +- .../machines/multi/MTELargeTurbineSteam.java | 1 - .../machines/multi/MTEMultiAutoclave.java | 5 ++-- .../machines/multi/MTEMultiCanner.java | 3 +-- .../tileentities/machines/multi/MTEMultiLathe.java | 2 +- .../machines/multi/MTEMultiSolidifier.java | 8 +++++-- .../tileentities/machines/multi/MTEPCBFactory.java | 6 ++++- .../machines/multi/MTEPlasmaForge.java | 8 +++---- .../machines/multi/MTEWormholeGenerator.java | 27 +++++++++------------- .../multi/compressor/MTEBlackHoleCompressor.java | 4 +--- .../machines/multi/drone/MTEDroneCentre.java | 3 +-- .../multi/purification/MTEPurificationPlant.java | 6 +---- .../purification/MTEPurificationUnitDegasser.java | 22 ++++-------------- .../machines/multiblock/DistillationTower.java | 2 +- .../tileentities/storage/MTEDigitalChestBase.java | 2 +- 37 files changed, 96 insertions(+), 129 deletions(-) (limited to 'src/main/java/gregtech/common/tileentities') diff --git a/src/main/java/gregtech/common/tileentities/casings/upgrade/Inventory.java b/src/main/java/gregtech/common/tileentities/casings/upgrade/Inventory.java index 43cc20f983..26f26604bf 100644 --- a/src/main/java/gregtech/common/tileentities/casings/upgrade/Inventory.java +++ b/src/main/java/gregtech/common/tileentities/casings/upgrade/Inventory.java @@ -22,7 +22,7 @@ public class Inventory extends UpgradeCasing { private String inventoryName = "inventory"; private int inventorySize; - private InventoryType type = InventoryType.Both; + private final InventoryType type = InventoryType.Both; public String getCustomInventoryName() { return inventoryName; diff --git a/src/main/java/gregtech/common/tileentities/casings/upgrade/Tank.java b/src/main/java/gregtech/common/tileentities/casings/upgrade/Tank.java index a7ace14de5..b373d79ab5 100644 --- a/src/main/java/gregtech/common/tileentities/casings/upgrade/Tank.java +++ b/src/main/java/gregtech/common/tileentities/casings/upgrade/Tank.java @@ -19,8 +19,8 @@ public class Tank extends UpgradeCasing { public static final int INPUT = 0; public static final int OUTPUT = 1; public static final int BOTH = 2; - private String tankName = "tank"; - private int type = BOTH; + private final String tankName = "tank"; + private final int type = BOTH; @Override protected void customWork(IMultiBlockController aTarget) { diff --git a/src/main/java/gregtech/common/tileentities/generators/MTEMagicalEnergyAbsorber.java b/src/main/java/gregtech/common/tileentities/generators/MTEMagicalEnergyAbsorber.java index 01d2e1ee07..242d8eaaea 100644 --- a/src/main/java/gregtech/common/tileentities/generators/MTEMagicalEnergyAbsorber.java +++ b/src/main/java/gregtech/common/tileentities/generators/MTEMagicalEnergyAbsorber.java @@ -85,11 +85,11 @@ public class MTEMagicalEnergyAbsorber extends MTEBasicGenerator implements Magic private static final Map sAspectsEnergy = new HashMap<>(); private static boolean sAllowMultipleEggs = false; private static MTEMagicalEnergyAbsorber sActiveSiphon = null; - private static int sEnergyPerEndercrystal = 512; - private static int sEnergyFromVis = 20; - private static int sEnergyPerEssentia = 320; - private static int sDragonEggEnergyPerTick = 2048; - private static int sCreeperEggEnergyPerTick = 512; + private static final int sEnergyPerEndercrystal = 512; + private static final int sEnergyFromVis = 20; + private static final int sEnergyPerEssentia = 320; + private static final int sDragonEggEnergyPerTick = 2048; + private static final int sCreeperEggEnergyPerTick = 512; private final MagicalEnergyBB mMagicalEnergyBB = new MagicalEnergyBB(this, mTier, mTier + 2); private int mEfficiency; private int mMaxVisPerDrain; diff --git a/src/main/java/gregtech/common/tileentities/generators/MTENaquadahReactor.java b/src/main/java/gregtech/common/tileentities/generators/MTENaquadahReactor.java index 276fdff07c..0bbe3bb7e7 100644 --- a/src/main/java/gregtech/common/tileentities/generators/MTENaquadahReactor.java +++ b/src/main/java/gregtech/common/tileentities/generators/MTENaquadahReactor.java @@ -33,7 +33,7 @@ import gregtech.api.render.TextureFactory; public class MTENaquadahReactor extends MTEBasicGenerator { - private int mEfficiency; + private final int mEfficiency; public MTENaquadahReactor(int aID, String aName, String[] aDescription, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, aDescription); diff --git a/src/main/java/gregtech/common/tileentities/generators/MTESteamTurbine.java b/src/main/java/gregtech/common/tileentities/generators/MTESteamTurbine.java index bb6138d35a..6564ecfe8f 100644 --- a/src/main/java/gregtech/common/tileentities/generators/MTESteamTurbine.java +++ b/src/main/java/gregtech/common/tileentities/generators/MTESteamTurbine.java @@ -230,7 +230,6 @@ public class MTESteamTurbine extends MTEBasicGenerator { public boolean isFluidInputAllowed(FluidStack aFluid) { if (GTModHandler.isSuperHeatedSteam(aFluid)) { aFluid.amount = 0; - aFluid = null; return false; } return super.isFluidInputAllowed(aFluid); diff --git a/src/main/java/gregtech/common/tileentities/machines/IDualInputHatch.java b/src/main/java/gregtech/common/tileentities/machines/IDualInputHatch.java index c89aaaff40..0660f6b1a1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/IDualInputHatch.java +++ b/src/main/java/gregtech/common/tileentities/machines/IDualInputHatch.java @@ -17,5 +17,5 @@ public interface IDualInputHatch { Optional getFirstNonEmptyInventory(); - public boolean supportsFluids(); + boolean supportsFluids(); } diff --git a/src/main/java/gregtech/common/tileentities/machines/ISmartInputHatch.java b/src/main/java/gregtech/common/tileentities/machines/ISmartInputHatch.java index dc5cac45f8..bbf6c5b631 100644 --- a/src/main/java/gregtech/common/tileentities/machines/ISmartInputHatch.java +++ b/src/main/java/gregtech/common/tileentities/machines/ISmartInputHatch.java @@ -10,6 +10,6 @@ public interface ISmartInputHatch { // Have the contents of the hatch changed since the last check? boolean justUpdated(); - public boolean doFastRecipeCheck(); + boolean doFastRecipeCheck(); } diff --git a/src/main/java/gregtech/common/tileentities/machines/MTEHatchCraftingInputME.java b/src/main/java/gregtech/common/tileentities/machines/MTEHatchCraftingInputME.java index b6adf65440..d1bc27310a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/MTEHatchCraftingInputME.java +++ b/src/main/java/gregtech/common/tileentities/machines/MTEHatchCraftingInputME.java @@ -323,16 +323,17 @@ public class MTEHatchCraftingInputME extends MTEHatchInputBus private @Nullable AENetworkProxy gridProxy = null; // holds all internal inventories - private PatternSlot[] internalInventory = new PatternSlot[MAX_PATTERN_COUNT]; + private final PatternSlot[] internalInventory = new PatternSlot[MAX_PATTERN_COUNT]; // a hash map for faster lookup of pattern slots, not necessarily all valid. - private Map patternDetailsPatternSlotMap = new HashMap<>(MAX_PATTERN_COUNT); + private final Map patternDetailsPatternSlotMap = new HashMap<>( + MAX_PATTERN_COUNT); private boolean needPatternSync = true; private boolean justHadNewItems = false; private String customName = null; - private boolean supportFluids; + private final boolean supportFluids; private boolean additionalConnection = false; private boolean disablePatternOptimization = false; @@ -571,15 +572,14 @@ public class MTEHatchCraftingInputME extends MTEHatchInputBus // Migrate from 4x8 to 4x9 pattern inventory int oldPatternCount = 4 * 8; int oldSlotManual = oldPatternCount + 1; - int oldSlotCircuit = oldPatternCount; if (internalInventory[oldSlotManual] == null && mInventory[oldSlotManual] != null) { mInventory[SLOT_MANUAL_START] = mInventory[oldSlotManual]; mInventory[oldSlotManual] = null; } - if (internalInventory[oldSlotCircuit] == null && mInventory[oldSlotCircuit] != null) { - mInventory[SLOT_CIRCUIT] = mInventory[oldSlotCircuit]; - mInventory[oldSlotCircuit] = null; + if (internalInventory[oldPatternCount] == null && mInventory[oldPatternCount] != null) { + mInventory[SLOT_CIRCUIT] = mInventory[oldPatternCount]; + mInventory[oldPatternCount] = null; } // reconstruct patternDetailsPatternSlotMap diff --git a/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputBusME.java b/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputBusME.java index 969d9c6c05..9e396b8b27 100644 --- a/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputBusME.java +++ b/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputBusME.java @@ -125,10 +125,7 @@ public class MTEHatchOutputBusME extends MTEHatchOutputBus implements IPowerChan * Check if the internal cache can still fit more items in it */ public boolean canAcceptItem() { - if (getCachedAmount() < getCacheCapacity()) { - return true; - } - return false; + return getCachedAmount() < getCacheCapacity(); } /** diff --git a/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputME.java b/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputME.java index 5983a2d32a..7ebe9929c3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputME.java +++ b/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputME.java @@ -147,10 +147,7 @@ public class MTEHatchOutputME extends MTEHatchOutput implements IPowerChannelSta * Check if the internal cache can still fit more fluids in it */ public boolean canAcceptFluid() { - if (getCachedAmount() < getCacheCapacity()) { - return true; - } - return false; + return getCachedAmount() < getCacheCapacity(); } /** diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/MTEPump.java b/src/main/java/gregtech/common/tileentities/machines/basic/MTEPump.java index a6a99a58fa..b8d9803951 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/MTEPump.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/MTEPump.java @@ -500,7 +500,7 @@ public class MTEPump extends MTEBasicMachine { for (int i = 0; i < mInputSlotCount; i++) { ItemStack stack = getInputAt(i); - if (stack != null && GTUtility.areStacksEqual(stack, MINING_PIPE) && stack.stackSize > 0) { + if (GTUtility.areStacksEqual(stack, MINING_PIPE) && stack.stackSize > 0) { foundPipe = true; break; } @@ -562,7 +562,7 @@ public class MTEPump extends MTEBasicMachine { for (int i = 0; i < mInputSlotCount; i++) { ItemStack stack = getInputAt(i); - if (stack != null && GTUtility.areStacksEqual(stack, MINING_PIPE) && stack.stackSize > 0) { + if (GTUtility.areStacksEqual(stack, MINING_PIPE) && stack.stackSize > 0) { foundPipe = true; stack.stackSize -= 1; if (stack.stackSize == 0) { diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/MTETurboCharger.java b/src/main/java/gregtech/common/tileentities/machines/basic/MTETurboCharger.java index 3e1ebd298e..c377600528 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/MTETurboCharger.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/MTETurboCharger.java @@ -87,10 +87,8 @@ public class MTETurboCharger extends MTECharger { } } - if (getBaseMetaTileEntity() instanceof BaseMetaTileEntity) { - BaseMetaTileEntity mBaseMetaTileEntity = (BaseMetaTileEntity) getBaseMetaTileEntity(); - if (mBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity) { - MetaTileEntity mMetaTileEntity = (MetaTileEntity) mBaseMetaTileEntity.getMetaTileEntity(); + if (getBaseMetaTileEntity() instanceof BaseMetaTileEntity mBaseMetaTileEntity) { + if (mBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity mMetaTileEntity) { if (mMetaTileEntity.dechargerSlotCount() > 0 && mBaseMetaTileEntity.getStoredEU() < mBaseMetaTileEntity.getEUCapacity()) { for (int i = mMetaTileEntity.dechargerSlotStartIndex(), diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/MTEWorldAccelerator.java b/src/main/java/gregtech/common/tileentities/machines/basic/MTEWorldAccelerator.java index bb086dc654..5046ecd8b1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/MTEWorldAccelerator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/MTEWorldAccelerator.java @@ -33,7 +33,7 @@ public class MTEWorldAccelerator extends MTETieredMachineBlock { // simple name is rather expensive to compute and it's not cached // see https://stackoverflow.com/q/17369304 - private static final ClassValue simpleNameCache = new ClassValue() { + private static final ClassValue simpleNameCache = new ClassValue<>() { @Override protected String computeValue(Class type) { @@ -87,7 +87,8 @@ public class MTEWorldAccelerator extends MTETieredMachineBlock { private static Textures.BlockIcons.CustomIcon _mGTIco_Norm_Active; private static Textures.BlockIcons.CustomIcon _mGTIco_TE_Idle; private static Textures.BlockIcons.CustomIcon _mGTIco_TE_Active; - private static int[] mAccelerateStatic = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 512, 512, 512, 512, 512, 512 }; + private static final int[] mAccelerateStatic = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 512, 512, 512, 512, 512, + 512 }; private static final int AMPERAGE_NORMAL = 3; private static final int AMPERAGE_TE = 6; @@ -272,7 +273,7 @@ public class MTEWorldAccelerator extends MTETieredMachineBlock { return 8; } - private static String[] mModeStr = { "Blocks", "TileEntities" }; + private static final String[] mModeStr = { "Blocks", "TileEntities" }; // This uses the Wrench as second tool to cycle speeds @Override @@ -297,8 +298,7 @@ public class MTEWorldAccelerator extends MTETieredMachineBlock { markDirty(); PlayerChatHelper .SendInfo(pPlayer, String.format("Machine radius changed to %d Blocks", getRadiusTierOverride())); - } else PlayerChatHelper - .SendError(pPlayer, String.format("Can't change radius; Machine is in TileEntity Mode!")); + } else PlayerChatHelper.SendError(pPlayer, "Can't change radius; Machine is in TileEntity Mode!"); } else { mMode = (byte) (mMode == 0x00 ? 0x01 : 0x00); markDirty(); diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineBase.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineBase.java index 6f6f01f3ba..259988c16a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineBase.java @@ -1,19 +1,19 @@ /** * * Inspired/ported from GregTech 6 under the LGPL license - * + *

* Copyright (c) 2020 GregTech-6 Team - * + *

* This file is part of GregTech. - * + *

* GregTech is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later * version. - * + *

* GregTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. - * + *

* You should have received a copy of the GNU Lesser General Public License along with GregTech. If not, see * . */ diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineFluid.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineFluid.java index e3886360c6..7cac54c4c6 100644 --- a/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineFluid.java +++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineFluid.java @@ -1,19 +1,19 @@ /** * * Inspired/ported from GregTech 6 under the LGPL license - * + *

* Copyright (c) 2020 GregTech-6 Team - * + *

* This file is part of GregTech. - * + *

* GregTech is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later * version. - * + *

* GregTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. - * + *

* You should have received a copy of the GNU Lesser General Public License along with GregTech. If not, see * . */ diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineItem.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineItem.java index f619d40329..e6d1ee0612 100644 --- a/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineItem.java +++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineItem.java @@ -1,19 +1,19 @@ /** * * Inspired/ported from GregTech 6 under the LGPL license - * + *

* Copyright (c) 2020 GregTech-6 Team - * + *

* This file is part of GregTech. - * + *

* GregTech is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later * version. - * + *

* GregTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. - * + *

* You should have received a copy of the GNU Lesser General Public License along with GregTech. If not, see * . */ diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java index 20b3ce4b32..43c383a102 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java @@ -270,8 +270,8 @@ public class MTEIndustrialElectromagneticSeparator if (!mExoticEnergyHatches.isEmpty()) { if (!mEnergyHatches.isEmpty()) return false; if (mExoticEnergyHatches.size() > 1) return false; - if (mExoticEnergyHatches.get(0) - .maxWorkingAmperesIn() > 64) return false; + return mExoticEnergyHatches.get(0) + .maxWorkingAmperesIn() <= 64; } // All checks passed! diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java index 79af9a2e6b..8efb36a5ed 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java @@ -310,9 +310,7 @@ public class MTEIndustrialLaserEngraver extends MTEExtendedPowerMultiBlockBase glassTier) return false; - - return true; + return glassTier >= VoltageIndex.UMV || laserSource.mTier <= glassTier; } private static String getUniqueIdentifier(ItemStack is) { @@ -594,7 +592,6 @@ public class MTEIndustrialLaserEngraver extends MTEExtendedPowerMultiBlockBase mGlassTier) { mStructureBadGlassTier = true; + break; } } @@ -203,10 +204,9 @@ public class MTELargeFluidExtractor extends MTEExtendedPowerMultiBlockBase(); - data.addAll(Arrays.asList(super.getInfoData())); + ArrayList data = new ArrayList<>(Arrays.asList(super.getInfoData())); data.add(String.format("Max Parallels: %s%d%s", YELLOW, getParallels(), RESET)); data.add(String.format("Heating Coil Speed Bonus: +%s%.0f%s %%", YELLOW, getCoilSpeedBonus() * 100, RESET)); data.add(String.format("Total Speed Multiplier: %s%.0f%s %%", YELLOW, getSpeedBonus() * 100, RESET)); data.add(String.format("Total EU/t Multiplier: %s%.0f%s %%", YELLOW, getEUMultiplier() * 100, RESET)); - return data.toArray(new String[data.size()]); + return data.toArray(new String[0]); } public int getParallels() { 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 a411621eaa..de35a7d3bc 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java @@ -396,7 +396,7 @@ public abstract class MTELargeTurbine extends MTEEnhancedMultiBlockBase aFluids, TurbineStatCalculator turbine) { - if (aFluids.size() >= 1) { + if (!aFluids.isEmpty()) { int tEU = 0; int actualOptimalFlow = 0; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbineGasAdvanced.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbineGasAdvanced.java index c1893f50c1..0eceb2cf8a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbineGasAdvanced.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbineGasAdvanced.java @@ -129,7 +129,7 @@ public class MTELargeTurbineGasAdvanced extends MTELargeTurbine { @Override int fluidIntoPower(ArrayList aFluids, TurbineStatCalculator turbine) { - if (aFluids.size() >= 1) { + if (!aFluids.isEmpty()) { int tEU = 0; int actualOptimalFlow = 0; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbinePlasma.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbinePlasma.java index b8f34c2a52..1a8b6c173c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbinePlasma.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbinePlasma.java @@ -124,7 +124,7 @@ public class MTELargeTurbinePlasma extends MTELargeTurbine { @Override int fluidIntoPower(ArrayList aFluids, TurbineStatCalculator turbine) { - if (aFluids.size() >= 1) { + if (!aFluids.isEmpty()) { int tEU = 0; int actualOptimalFlow = 0; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbineSteam.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbineSteam.java index 8c6f00d52f..37b6f281e2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbineSteam.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbineSteam.java @@ -208,7 +208,6 @@ public class MTELargeTurbineSteam extends MTELargeTurbine { @Override public String[] getInfoData() { - super.looseFit = looseFit; return super.getInfoData(); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiAutoclave.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiAutoclave.java index c07089a3aa..1d82114ad8 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiAutoclave.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiAutoclave.java @@ -243,7 +243,7 @@ public class MTEMultiAutoclave extends MTEExtendedPowerMultiBlockBase= 0 && mCasingAmount >= 128 && itemPipeTier >= 0 - && mEnergyHatches.size() >= 1 + && !mEnergyHatches.isEmpty() && mMufflerHatches.size() == 1; } @@ -294,8 +294,7 @@ public class MTEMultiAutoclave extends MTEExtendedPowerMultiBlockBase= 85; // All checks passed! - return true; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiLathe.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiLathe.java index 784d12c12c..c10736c587 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiLathe.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiLathe.java @@ -306,7 +306,7 @@ public class MTEMultiLathe extends MTEExtendedPowerMultiBlockBase if (!checkPiece(STRUCTURE_PIECE_BODY, 3, 4, -1) && !checkPiece(STRUCTURE_PIECE_BODY_ALT, 3, 4, -1)) return false; return this.mMaintenanceHatches.size() == 1 && pipeTier > 0 - && mEnergyHatches.size() >= 1 + && !mEnergyHatches.isEmpty() && mCasingAmount >= 42 && mMufflerHatches.size() == 1; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java index 5597023871..ebd939536c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java @@ -44,6 +44,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.logic.ProcessingLogic; import gregtech.api.metatileentity.implementations.MTEExtendedPowerMultiBlockBase; +import gregtech.api.metatileentity.implementations.MTEHatchEnergy; import gregtech.api.metatileentity.implementations.MTEHatchInput; import gregtech.api.metatileentity.implementations.MTEHatchInputBus; import gregtech.api.recipe.RecipeMap; @@ -310,8 +311,11 @@ public class MTEMultiSolidifier extends MTEExtendedPowerMultiBlockBase= VoltageIndex.UMV) return true; - for (int i = 0; i < this.mEnergyHatches.size(); ++i) - if (this.mEnergyHatches.get(i).mTier > glassTier) return false; + for (MTEHatchEnergy mEnergyHatch : this.mEnergyHatches) { + if (mEnergyHatch.mTier > glassTier) { + return false; + } + } return mCasingAmount >= (100 + mWidth * 23); } 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 5618232442..21c913e486 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEPCBFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEPCBFactory.java @@ -105,7 +105,11 @@ public class MTEPCBFactory extends MTEExtendedPowerMultiBlockBase private static final String ocTier1Upgrade = "ocTier1Upgrade"; private static final String ocTier2Upgrade = "ocTier2Upgrade"; private float mRoughnessMultiplier = 1; - private int mTier = 1, mSetTier = 1, mUpgradesInstalled = 0, mCurrentParallel = 0, mMaxParallel = 0; + private int mTier = 1; + private int mSetTier = 1; + private int mUpgradesInstalled = 0; + private final int mCurrentParallel = 0; + private int mMaxParallel = 0; private boolean mBioUpgrade = false, mBioRotate = false, mOCTier1 = false, mOCTier2 = false; private final int[] mBioOffsets = new int[] { -5, -1 }; private final int[] mOCTier1Offsets = new int[] { 2, -11 }; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEPlasmaForge.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEPlasmaForge.java index 0eb43414e4..5f45139e1e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEPlasmaForge.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEPlasmaForge.java @@ -849,13 +849,13 @@ public class MTEPlasmaForge extends MTEExtendedPowerMultiBlockBase 0) { - if (mEnergyHatches.size() > 0) return false; + if (!mExoticEnergyHatches.isEmpty()) { + if (!mEnergyHatches.isEmpty()) return false; if (mExoticEnergyHatches.size() > 1) return false; } // If there is 0 or more than 2 energy hatches structure check will fail. - if (mEnergyHatches.size() > 0) { + if (!mEnergyHatches.isEmpty()) { if (mEnergyHatches.size() > 2) return false; // Check will also fail if energy hatches are not of the same tier. @@ -868,7 +868,7 @@ public class MTEPlasmaForge extends MTEExtendedPowerMultiBlockBase mGlassTier) { mStructureBadGlassTier = true; + break; } } @@ -426,12 +427,7 @@ public class MTEWormholeGenerator extends MTEEnhancedMultiBlockBase data = new ArrayList<>(); - data.addAll(Arrays.asList(super.getInfoData())); + List data = new ArrayList<>(Arrays.asList(super.getInfoData())); data.add("-----------------------"); data.add("Wormhole Generator Info"); if (mStructureBadGlassTier) { - data.add(String.format("§cStructure errors:§r")); + data.add("§cStructure errors:§r"); if (mStructureBadGlassTier) { - data.add(String.format("§cGlass tier must be greater than or equal to the energy hatch tiers.§r")); + data.add("§cGlass tier must be greater than or equal to the energy hatch tiers.§r"); } } @@ -1056,7 +1051,7 @@ public class MTEWormholeGenerator extends MTEEnhancedMultiBlockBase { if (mLink == null) { - return String.format("§7Missing Entangled Singularity§f"); + return "§7Missing Entangled Singularity§f"; } if (!mLink.isFormed()) { - return String.format("§7Wormhole status: §cNo destination§f"); + return "§7Wormhole status: §cNo destination§f"; } if (mLink.mWormholeEnergy > 0 && !mLink.isActive()) { - return String.format("§7Wormhole status: §6Decaying§f"); + return "§7Wormhole status: §6Decaying§f"; } if (mLink.mWormholeEnergy > 0) { - return String.format("§7Wormhole status: §bActive§f"); + return "§7Wormhole status: §bActive§f"; } - return String.format("§7Wormhole status: Inactive§f"); + return "§7Wormhole status: Inactive§f"; }), TextWidget.dynamicString(() -> { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java index edfa676b53..35080a329c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java @@ -424,9 +424,7 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase= 950; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/drone/MTEDroneCentre.java b/src/main/java/gregtech/common/tileentities/machines/multi/drone/MTEDroneCentre.java index cf52680d71..f84e2a7af0 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/drone/MTEDroneCentre.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/drone/MTEDroneCentre.java @@ -787,8 +787,7 @@ public class MTEDroneCentre extends MTEExtendedPowerMultiBlockBase