diff options
author | Alexdoru <57050655+Alexdoru@users.noreply.github.com> | 2024-10-02 07:31:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-02 05:31:08 +0000 |
commit | 3b9bd1188e932e6bb8041f7bb9afbf3ce75e26d3 (patch) | |
tree | 107d9d2442891990ef1cdef1d8bb2df6bb96952a /src/main/java/gregtech/common/tileentities | |
parent | bfc7b2b07f72d0903a70791ff96f9c837ddd5ff0 (diff) | |
download | GT5-Unofficial-3b9bd1188e932e6bb8041f7bb9afbf3ce75e26d3.tar.gz GT5-Unofficial-3b9bd1188e932e6bb8041f7bb9afbf3ce75e26d3.tar.bz2 GT5-Unofficial-3b9bd1188e932e6bb8041f7bb9afbf3ce75e26d3.zip |
Cleanup the codebase (#3311)
Co-authored-by: boubou19 <miisterunknown@gmail.com>
Diffstat (limited to 'src/main/java/gregtech/common/tileentities')
37 files changed, 96 insertions, 129 deletions
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<Aspect, Integer> 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<IDualInputInventory> 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<ICraftingPatternDetails, PatternSlot> patternDetailsPatternSlotMap = new HashMap<>(MAX_PATTERN_COUNT); + private final Map<ICraftingPatternDetails, PatternSlot> 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<String> simpleNameCache = new ClassValue<String>() { + private static final ClassValue<String> 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 - * + * <p> * Copyright (c) 2020 GregTech-6 Team - * + * <p> * This file is part of GregTech. - * + * <p> * 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. - * + * <p> * 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. - * + * <p> * You should have received a copy of the GNU Lesser General Public License along with GregTech. If not, see * <http://www.gnu.org/licenses/>. */ 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 - * + * <p> * Copyright (c) 2020 GregTech-6 Team - * + * <p> * This file is part of GregTech. - * + * <p> * 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. - * + * <p> * 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. - * + * <p> * You should have received a copy of the GNU Lesser General Public License along with GregTech. If not, see * <http://www.gnu.org/licenses/>. */ 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 - * + * <p> * Copyright (c) 2020 GregTech-6 Team - * + * <p> * This file is part of GregTech. - * + * <p> * 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. - * + * <p> * 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. - * + * <p> * You should have received a copy of the GNU Lesser General Public License along with GregTech. If not, see * <http://www.gnu.org/licenses/>. */ 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<M if (mCasingAmount < 35) return false; if (laserSource == null) return false; if (!findLaserRenderer(base.getWorld(), base.getXCoord(), base.getYCoord(), base.getZCoord())) return false; - if (glassTier < VoltageIndex.UMV && laserSource.mTier > 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<M lensColors.put("gt.bwMetaGeneratedlens11499", Colors.Green); lensColors.put("gt.bwMetaGeneratedlens11358", Colors.Red); lensColors.put("MU-metaitem.0132140", Colors.Purple); - lensColors.put("MU-metaitem.0132140", Colors.Purple); // } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java index fe7994f8a1..16a89bcb93 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java @@ -176,6 +176,7 @@ public class MTELargeFluidExtractor extends MTEExtendedPowerMultiBlockBase<MTELa if (mGlassTier < 10 && energyHatch.getTierForStructure() > mGlassTier) { mStructureBadGlassTier = true; + break; } } @@ -203,10 +204,9 @@ public class MTELargeFluidExtractor extends MTEExtendedPowerMultiBlockBase<MTELa logic.setAmperageOC(true); logic.setAvailableVoltage(this.getMaxInputEu()); logic.setAvailableAmperage(1); - - logic.setEuModifier((float) (getEUMultiplier())); + logic.setEuModifier(getEUMultiplier()); logic.setMaxParallel(getParallels()); - logic.setSpeedBonus(1.0f / (float) (getSpeedBonus())); + logic.setSpeedBonus(1.0f / getSpeedBonus()); } @Override @@ -390,16 +390,15 @@ public class MTELargeFluidExtractor extends MTEExtendedPowerMultiBlockBase<MTELa @Override public String[] getInfoData() { - var data = new ArrayList<String>(); - data.addAll(Arrays.asList(super.getInfoData())); + ArrayList<String> 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<MTELarge maxEnergy += tHatch.getBaseMetaTileEntity() .getEUCapacity(); } - String[] ret = new String[] { + return new String[] { // 8 Lines available for information panels tRunning + ": " + EnumChatFormatting.RED @@ -441,7 +441,6 @@ public abstract class MTELargeTurbine extends MTEEnhancedMultiBlockBase<MTELarge + EnumChatFormatting.RESET + " %" /* 8 */ }; - return ret; } public boolean hasTurbine() { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbineGas.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbineGas.java index ff78aec1f1..50bb13d003 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbineGas.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbineGas.java @@ -130,7 +130,7 @@ public class MTELargeTurbineGas extends MTELargeTurbine { @Override int fluidIntoPower(ArrayList<FluidStack> 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<FluidStack> 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<FluidStack> 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<MTEMultiAu return this.mMaintenanceHatches.size() == 1 && fluidPipeTier >= 0 && mCasingAmount >= 128 && itemPipeTier >= 0 - && mEnergyHatches.size() >= 1 + && !mEnergyHatches.isEmpty() && mMufflerHatches.size() == 1; } @@ -294,8 +294,7 @@ public class MTEMultiAutoclave extends MTEExtendedPowerMultiBlockBase<MTEMultiAu @Override public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { if (mMachine) return -1; - int build = survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 3, 6, 0, elementBudget, env, false, true); - return build; + return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 3, 6, 0, elementBudget, env, false, true); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiCanner.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiCanner.java index 3af4b17e29..7d26a18a81 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiCanner.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiCanner.java @@ -184,10 +184,9 @@ public class MTEMultiCanner extends MTEExtendedPowerMultiBlockBase<MTEMultiCanne mEnergyHatches.clear(); if (!checkPiece(STRUCTURE_PIECE_MAIN, 3, 2, 2)) return false; - if (mCasingAmount < 85) return false; + return mCasingAmount >= 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<MTEMultiLathe> 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<MTEMultiS return false; } if (glassTier >= 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<MTEPCBFactory> 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<MTEPlasmaForg // If there is more than 1 TT energy hatch, the structure check will fail. // If there is a TT hatch and a normal hatch, the structure check will fail. - if (mExoticEnergyHatches.size() > 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<MTEPlasmaForg } // If there are no energy hatches or TT energy hatches, structure will fail to form. - if ((mEnergyHatches.size() == 0) && (mExoticEnergyHatches.size() == 0)) return false; + if ((mEnergyHatches.isEmpty()) && (mExoticEnergyHatches.isEmpty())) return false; // Maintenance hatch not required but left for compatibility. // Don't allow more than 1, no free casing spam! diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEWormholeGenerator.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEWormholeGenerator.java index 74f7d4c655..5438f3daa5 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEWormholeGenerator.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEWormholeGenerator.java @@ -322,6 +322,7 @@ public class MTEWormholeGenerator extends MTEEnhancedMultiBlockBase<MTEWormholeG if (energyHatch.getTierForStructure() > mGlassTier) { mStructureBadGlassTier = true; + break; } } @@ -426,12 +427,7 @@ public class MTEWormholeGenerator extends MTEEnhancedMultiBlockBase<MTEWormholeG world.setBlock(xTarget, yTarget, zTarget, Blocks.air); world.setBlock(xTarget, yTarget, zTarget, GregTechAPI.sWormholeRender); - TileEntityWormhole wormhole = (TileEntityWormhole) world.getTileEntity(xTarget, yTarget, zTarget); - - if (wormhole == null) { - return null; - } - return wormhole; + return (TileEntityWormhole) world.getTileEntity(xTarget, yTarget, zTarget); } @Nullable @@ -968,18 +964,17 @@ public class MTEWormholeGenerator extends MTEEnhancedMultiBlockBase<MTEWormholeG @Override public String[] getInfoData() { - List<String> data = new ArrayList<>(); - data.addAll(Arrays.asList(super.getInfoData())); + List<String> 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<MTEWormholeG data.add("-----------------------"); - return data.toArray(new String[data.size()]); + return data.toArray(new String[0]); } @Override @@ -1065,22 +1060,22 @@ public class MTEWormholeGenerator extends MTEEnhancedMultiBlockBase<MTEWormholeG screenElements.widgets(TextWidget.dynamicString(() -> { 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<MTEBl spacetimeHatches.clear(); if (!checkPiece(STRUCTURE_PIECE_MAIN, 17, 27, 10)) return false; - if (mCasingAmount < 950) return false; - - return true; + return mCasingAmount >= 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<MTEDroneCentr } }) .addTooltip(StatCollector.translateToLocal("GT5U.gui.button.drone_highlight")) - .setBackground( - new IDrawable[] { GTUITextures.BUTTON_STANDARD, GTUITextures.OVERLAY_BUTTON_INVERT_REDSTONE }) + .setBackground(GTUITextures.BUTTON_STANDARD, GTUITextures.OVERLAY_BUTTON_INVERT_REDSTONE) .setSize(16, 16)); // Show the reason why the machine shutdown row.widget( diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationPlant.java b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationPlant.java index 2c575528ab..7b93e4ce07 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationPlant.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationPlant.java @@ -338,11 +338,7 @@ public class MTEPurificationPlant extends MTEExtendedPowerMultiBlockBase<MTEPuri } // using nano forge method of detecting hatches. - if (!checkExoticAndNormalEnergyHatches()) { - return false; - } - - return true; + return checkExoticAndNormalEnergyHatches(); } private boolean checkHatches() { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java index b139a0f6d4..05e8c9282d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java @@ -305,11 +305,9 @@ public class MTEPurificationUnitDegasser extends MTEPurificationUnitBase<MTEPuri .addInfo("Denote the lowest bit as bit 1, and the highest as bit 4.") .addSeparator() .addInfo( - EnumChatFormatting.WHITE + "" - + EnumChatFormatting.BOLD + EnumChatFormatting.WHITE.toString() + EnumChatFormatting.BOLD + "Bit 1: " + EnumChatFormatting.BLUE - + "" + EnumChatFormatting.BOLD + "Ozone Sparging by Inert Gas") .addInfo( @@ -351,11 +349,9 @@ public class MTEPurificationUnitDegasser extends MTEPurificationUnitBase<MTEPuri + "Xenon") .addSeparator() .addInfo( - EnumChatFormatting.WHITE + "" - + EnumChatFormatting.BOLD + EnumChatFormatting.WHITE.toString() + EnumChatFormatting.BOLD + "Bit 2: " + EnumChatFormatting.BLUE - + "" + EnumChatFormatting.BOLD + "Superconductive Deionization") .addInfo( @@ -390,7 +386,6 @@ public class MTEPurificationUnitDegasser extends MTEPurificationUnitBase<MTEPuri + EnumChatFormatting.GRAY + " / " + EnumChatFormatting.DARK_BLUE - + "" + EnumChatFormatting.BOLD + "UIV" + EnumChatFormatting.GRAY @@ -400,7 +395,6 @@ public class MTEPurificationUnitDegasser extends MTEPurificationUnitBase<MTEPuri + EnumChatFormatting.GRAY + " / " + EnumChatFormatting.RED - + "" + EnumChatFormatting.BOLD + "UMV" + EnumChatFormatting.GRAY @@ -409,11 +403,9 @@ public class MTEPurificationUnitDegasser extends MTEPurificationUnitBase<MTEPuri + "2x") .addSeparator() .addInfo( - EnumChatFormatting.WHITE + "" - + EnumChatFormatting.BOLD + EnumChatFormatting.WHITE.toString() + EnumChatFormatting.BOLD + "Bit 3: " + EnumChatFormatting.BLUE - + "" + EnumChatFormatting.BOLD + "Gravitationally-Generated Differential Vacuum Extraction") .addInfo( @@ -423,11 +415,9 @@ public class MTEPurificationUnitDegasser extends MTEPurificationUnitBase<MTEPuri + "Molten Neutronium") .addSeparator() .addInfo( - EnumChatFormatting.WHITE + "" - + EnumChatFormatting.BOLD + EnumChatFormatting.WHITE.toString() + EnumChatFormatting.BOLD + "Bit 4: " + EnumChatFormatting.BLUE - + "" + EnumChatFormatting.BOLD + "Seldonian Settlement Process") .addInfo( @@ -437,11 +427,9 @@ public class MTEPurificationUnitDegasser extends MTEPurificationUnitBase<MTEPuri + "all other bits and do not insert anything.") .addSeparator() .addInfo( - EnumChatFormatting.WHITE + "" - + EnumChatFormatting.BOLD + EnumChatFormatting.WHITE.toString() + EnumChatFormatting.BOLD + "No bits: " + EnumChatFormatting.BLUE - + "" + EnumChatFormatting.BOLD + "Machine Overload") .addInfo("In rare cases, the machine may overload and output no control signal at all.") diff --git a/src/main/java/gregtech/common/tileentities/machines/multiblock/DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multiblock/DistillationTower.java index d4ac6241d2..e3a97cfebc 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multiblock/DistillationTower.java +++ b/src/main/java/gregtech/common/tileentities/machines/multiblock/DistillationTower.java @@ -32,7 +32,7 @@ public class DistillationTower extends StackableController<DistillationTower, Di private static final Vec3Impl STRUCTURE_OFFSET_MEGA_STACK = new Vec3Impl(0, 3, 0); private static final String STACKABLE_MIDDLE_1 = "STACKABLE_MIDDLE_1"; private static final String STACKABLE_MIDDLE_2 = "STACKABLE_MIDDLE_2"; - private boolean isMega = true; + private final boolean isMega = true; @Override public short getCasingRegistryID() { diff --git a/src/main/java/gregtech/common/tileentities/storage/MTEDigitalChestBase.java b/src/main/java/gregtech/common/tileentities/storage/MTEDigitalChestBase.java index 96ec6c06ae..d67240919a 100644 --- a/src/main/java/gregtech/common/tileentities/storage/MTEDigitalChestBase.java +++ b/src/main/java/gregtech/common/tileentities/storage/MTEDigitalChestBase.java @@ -227,7 +227,7 @@ public abstract class MTEDigitalChestBase extends MTETieredMachineBlock final long notAdded = itemCount + toAdd - maxCapacity; if (mode == appeng.api.config.Actionable.MODULATE) { - final int newCount = (int) Math.min((long) maxCapacity, itemCount + toAdd); + final int newCount = (int) Math.min(maxCapacity, itemCount + toAdd); if (storedStack == null) { setItemStack(inputStack.copy()); |