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 --- src/main/java/gregtech/common/GTProxy.java | 6 ++--- .../java/gregtech/common/GTWorldgenerator.java | 8 +++---- src/main/java/gregtech/common/Pollution.java | 4 ++-- .../java/gregtech/common/WorldgenGTOreLayer.java | 2 +- .../gregtech/common/WorldgenGTOreSmallPieces.java | 2 +- src/main/java/gregtech/common/WorldgenStone.java | 4 ++-- .../java/gregtech/common/blocks/BlockGlass1.java | 2 +- .../java/gregtech/common/blocks/BlockMachines.java | 2 +- .../gregtech/common/blocks/BlockOresAbstract.java | 2 +- .../java/gregtech/common/blocks/ItemMachines.java | 2 +- .../java/gregtech/common/covers/CoverConveyor.java | 6 ++--- .../java/gregtech/common/covers/CoverDoesWork.java | 9 ++++---- .../common/covers/CoverFluidRegulator.java | 3 --- .../java/gregtech/common/covers/CoverPump.java | 6 ++--- .../redstone/CoverWirelessDoesWorkDetector.java | 3 +-- .../gui/modularui/widget/TextButtonWidget.java | 4 ++-- .../common/items/behaviors/BehaviourDataOrb.java | 2 +- .../items/behaviors/BehaviourSwitchMode.java | 3 +-- .../gregtech/common/render/BlackholeRenderer.java | 2 +- .../common/render/FluidDisplayStackRenderer.java | 2 +- .../gregtech/common/render/GTRendererBlock.java | 2 +- .../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 +- 58 files changed, 131 insertions(+), 170 deletions(-) (limited to 'src/main/java/gregtech/common') diff --git a/src/main/java/gregtech/common/GTProxy.java b/src/main/java/gregtech/common/GTProxy.java index 659c626e2f..01d6315ebf 100644 --- a/src/main/java/gregtech/common/GTProxy.java +++ b/src/main/java/gregtech/common/GTProxy.java @@ -1816,7 +1816,7 @@ public abstract class GTProxy implements IGTMod, IFuelHandler { return; } String tName = aEvent.Name.replaceFirst(aPrefix.toString(), ""); - if (tName.length() > 0) { + if (!tName.isEmpty()) { char firstChar = tName.charAt(0); if (Character.isUpperCase(firstChar) || Character.isLowerCase(firstChar) || firstChar == '_' @@ -2197,7 +2197,7 @@ public abstract class GTProxy implements IGTMod, IFuelHandler { && ((this.mItemDespawnTime != 6000) || (this.mMaxEqualEntitiesAtOneSpot > 0))) { long startTime = System.nanoTime(); double oldX = 0, oldY = 0, oldZ = 0; - if (debugEntityCramming && (aEvent.world.loadedEntityList.size() != 0)) { + if (debugEntityCramming && (!aEvent.world.loadedEntityList.isEmpty())) { GTLog.out.println("CRAM: Entity list size " + aEvent.world.loadedEntityList.size()); } for (int i = 0; i < aEvent.world.loadedEntityList.size(); i++) { @@ -2247,7 +2247,7 @@ public abstract class GTProxy implements IGTMod, IFuelHandler { } } } - if (debugEntityCramming && (aEvent.world.loadedEntityList.size() != 0)) { + if (debugEntityCramming && (!aEvent.world.loadedEntityList.isEmpty())) { GTLog.out.println( "CRAM: Time spent checking " + (System.nanoTime() - startTime) / 1000 + " microseconds"); } diff --git a/src/main/java/gregtech/common/GTWorldgenerator.java b/src/main/java/gregtech/common/GTWorldgenerator.java index 14073d3325..17cba34369 100644 --- a/src/main/java/gregtech/common/GTWorldgenerator.java +++ b/src/main/java/gregtech/common/GTWorldgenerator.java @@ -204,7 +204,7 @@ public class GTWorldgenerator implements IWorldGenerator { public enum OregenPattern { // The last value is used when creating a new world AXISSYMMETRICAL, - EQUAL_SPACING; + EQUAL_SPACING } public static class WorldGenContainer implements Runnable { @@ -326,7 +326,7 @@ public class GTWorldgenerator implements IWorldGenerator { // Search for a valid orevein for this dimension if (!validOreveins.containsKey(oreveinSeed)) { if ((oreveinPercentageRoll < oreveinPercentage) && (WorldgenGTOreLayer.sWeight > 0) - && (WorldgenGTOreLayer.sList.size() > 0)) { + && (!WorldgenGTOreLayer.sList.isEmpty())) { int placementAttempts = 0; boolean oreveinFound = false; int i; @@ -549,7 +549,7 @@ public class GTWorldgenerator implements IWorldGenerator { } // Now process each oreseed vs this requested chunk - for (; seedList.size() != 0; seedList.remove(0)) { + for (; !seedList.isEmpty(); seedList.remove(0)) { if (debugWorldGen) GTLog.out.println("Processing seed x=" + seedList.get(0).mX + " z=" + seedList.get(0).mZ); worldGenFindVein(seedList.get(0).mX, seedList.get(0).mZ); @@ -593,7 +593,7 @@ public class GTWorldgenerator implements IWorldGenerator { short secondaryMeta = 0; short betweenMeta = 0; short sporadicMeta = 0; - if ((WorldgenGTOreLayer.sWeight > 0) && (WorldgenGTOreLayer.sList.size() > 0)) { + if ((WorldgenGTOreLayer.sWeight > 0) && (!WorldgenGTOreLayer.sList.isEmpty())) { boolean temp = true; int tRandomWeight; for (int i = 0; (i < oreveinAttempts) && (temp); i++) { diff --git a/src/main/java/gregtech/common/Pollution.java b/src/main/java/gregtech/common/Pollution.java index 928b944142..4245a0ef12 100644 --- a/src/main/java/gregtech/common/Pollution.java +++ b/src/main/java/gregtech/common/Pollution.java @@ -107,13 +107,13 @@ public class Pollution { // make a snapshot of what to work on pollutionList = new ArrayList<>(pollutedChunks); // set operations per tick - if (pollutionList.size() > 0) operationsPerTick = Math.max(1, pollutionList.size() / cycleLen); + if (!pollutionList.isEmpty()) operationsPerTick = Math.max(1, pollutionList.size() / cycleLen); else operationsPerTick = 0; // SANity blank = false; } for (int chunksProcessed = 0; chunksProcessed < operationsPerTick; chunksProcessed++) { - if (pollutionList.size() == 0) break; // no more stuff to do + if (pollutionList.isEmpty()) break; // no more stuff to do ChunkCoordIntPair actualPos = pollutionList.remove(pollutionList.size() - 1); // faster // get pollution ChunkData currentData = STORAGE.get(world, actualPos); diff --git a/src/main/java/gregtech/common/WorldgenGTOreLayer.java b/src/main/java/gregtech/common/WorldgenGTOreLayer.java index a8f57ef1de..2a31395a69 100644 --- a/src/main/java/gregtech/common/WorldgenGTOreLayer.java +++ b/src/main/java/gregtech/common/WorldgenGTOreLayer.java @@ -92,7 +92,7 @@ public class WorldgenGTOreLayer extends GTWorldgen { if (this.mEnd) { allowedProviders.add(WorldProviderEnd.class); } - mAllowedProviders = allowedProviders.toArray(new Class[allowedProviders.size()]); + mAllowedProviders = allowedProviders.toArray(new Class[0]); } @Override diff --git a/src/main/java/gregtech/common/WorldgenGTOreSmallPieces.java b/src/main/java/gregtech/common/WorldgenGTOreSmallPieces.java index 86d9c84e5f..4eb4eb4cce 100644 --- a/src/main/java/gregtech/common/WorldgenGTOreSmallPieces.java +++ b/src/main/java/gregtech/common/WorldgenGTOreSmallPieces.java @@ -59,7 +59,7 @@ public class WorldgenGTOreSmallPieces extends GTWorldgen { if (this.mEnd) { allowedProviders.add(WorldProviderEnd.class); } - mAllowedProviders = allowedProviders.toArray(new Class[allowedProviders.size()]); + mAllowedProviders = allowedProviders.toArray(new Class[0]); } @Override diff --git a/src/main/java/gregtech/common/WorldgenStone.java b/src/main/java/gregtech/common/WorldgenStone.java index 9533fd46e8..dd42146ea7 100644 --- a/src/main/java/gregtech/common/WorldgenStone.java +++ b/src/main/java/gregtech/common/WorldgenStone.java @@ -129,9 +129,9 @@ public class WorldgenStone extends GTWorldgen { } } - boolean result = stones.size() != 0; + boolean result = !stones.isEmpty(); // Now process each oreseed vs this requested chunk - for (; stones.size() != 0; stones.remove(0)) { + for (; !stones.isEmpty(); stones.remove(0)) { int x = stones.get(0).mX * 16; int z = stones.get(0).mZ * 16; diff --git a/src/main/java/gregtech/common/blocks/BlockGlass1.java b/src/main/java/gregtech/common/blocks/BlockGlass1.java index a8a287248b..6081b79d64 100644 --- a/src/main/java/gregtech/common/blocks/BlockGlass1.java +++ b/src/main/java/gregtech/common/blocks/BlockGlass1.java @@ -16,7 +16,7 @@ import gregtech.api.util.GTLanguageManager; /** * The glass is split into separate files because they are registered as regular blocks, and a regular block can have * 16 subtypes at most. - * + *

* This class hosts various special types of tiered glass with not many tiers. */ public class BlockGlass1 extends BlockCasingsAbstract { diff --git a/src/main/java/gregtech/common/blocks/BlockMachines.java b/src/main/java/gregtech/common/blocks/BlockMachines.java index 4c392f8cf5..f19a986529 100644 --- a/src/main/java/gregtech/common/blocks/BlockMachines.java +++ b/src/main/java/gregtech/common/blocks/BlockMachines.java @@ -140,7 +140,7 @@ public class BlockMachines extends GTGenericBlock implements IDebugableBlock, IT if (GTRendererBlock.INSTANCE == null) { return super.getRenderType(); } - return GTRendererBlock.INSTANCE.mRenderID; + return GTRendererBlock.mRenderID; } @Override diff --git a/src/main/java/gregtech/common/blocks/BlockOresAbstract.java b/src/main/java/gregtech/common/blocks/BlockOresAbstract.java index 358ae50e7f..ef17deb6c8 100644 --- a/src/main/java/gregtech/common/blocks/BlockOresAbstract.java +++ b/src/main/java/gregtech/common/blocks/BlockOresAbstract.java @@ -215,7 +215,7 @@ public abstract class BlockOresAbstract extends GTGenericBlock implements ITileE if (GTRendererBlock.INSTANCE == null) { return super.getRenderType(); } - return GTRendererBlock.INSTANCE.mRenderID; + return GTRendererBlock.mRenderID; } @Override diff --git a/src/main/java/gregtech/common/blocks/ItemMachines.java b/src/main/java/gregtech/common/blocks/ItemMachines.java index f6816f468a..92f1675a44 100644 --- a/src/main/java/gregtech/common/blocks/ItemMachines.java +++ b/src/main/java/gregtech/common/blocks/ItemMachines.java @@ -179,7 +179,7 @@ public class ItemMachines extends ItemBlock implements IFluidContainerItem { if (aList != null) aList.add(tTranslated); } else { String tTranslated = GTLanguageManager.addStringLocalization(tKey, tDescLine); - if (aList != null) aList.add(tTranslated.equals("") ? tDescLine : tTranslated); + if (aList != null) aList.add(tTranslated.isEmpty() ? tDescLine : tTranslated); } } } diff --git a/src/main/java/gregtech/common/covers/CoverConveyor.java b/src/main/java/gregtech/common/covers/CoverConveyor.java index cb2690d95b..582e0b4e0c 100644 --- a/src/main/java/gregtech/common/covers/CoverConveyor.java +++ b/src/main/java/gregtech/common/covers/CoverConveyor.java @@ -2,7 +2,7 @@ package gregtech.common.covers; import static gregtech.api.util.GTUtility.moveMultipleItemStacks; -import java.util.Arrays; +import java.util.Collections; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; @@ -226,7 +226,7 @@ public class CoverConveyor extends CoverBehavior { }) .dynamicTooltip(() -> { ISerializableObject.LegacyCoverData coverData = getCoverData(); - return Arrays.asList( + return Collections.singletonList( coverData == null || coverData.get() % 2 == 0 ? GTUtility.trans("314", "Allow Input") : GTUtility.trans("312", "Allow Output")); @@ -243,7 +243,7 @@ public class CoverConveyor extends CoverBehavior { }) .dynamicTooltip(() -> { ISerializableObject.LegacyCoverData coverData = getCoverData(); - return Arrays.asList( + return Collections.singletonList( coverData == null || coverData.get() % 2 == 0 ? GTUtility.trans("313", "Block Input") : GTUtility.trans("311", "Block Output")); diff --git a/src/main/java/gregtech/common/covers/CoverDoesWork.java b/src/main/java/gregtech/common/covers/CoverDoesWork.java index 1575f243ab..4998373a64 100644 --- a/src/main/java/gregtech/common/covers/CoverDoesWork.java +++ b/src/main/java/gregtech/common/covers/CoverDoesWork.java @@ -20,9 +20,9 @@ import gregtech.common.gui.modularui.widget.CoverDataFollowerToggleButtonWidget; public class CoverDoesWork extends CoverBehavior { - private static int FLAG_INVERTED = 0x1; - private static int FLAG_PROGRESS = 0x2; - private static int FLAG_ENABLED = 0x4; + private static final int FLAG_INVERTED = 0x1; + private static final int FLAG_PROGRESS = 0x2; + private static final int FLAG_ENABLED = 0x4; public CoverDoesWork(ITexture coverTexture) { super(coverTexture); @@ -37,8 +37,7 @@ public class CoverDoesWork extends CoverBehavior { @Override public int doCoverThings(ForgeDirection side, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { - if ((aTileEntity instanceof IMachineProgress)) { - IMachineProgress mProgress = (IMachineProgress) aTileEntity; + if ((aTileEntity instanceof IMachineProgress mProgress)) { boolean inverted = isFlagSet(aCoverVariable, FLAG_INVERTED); int signal = 0; diff --git a/src/main/java/gregtech/common/covers/CoverFluidRegulator.java b/src/main/java/gregtech/common/covers/CoverFluidRegulator.java index 1895df509d..98e881753a 100644 --- a/src/main/java/gregtech/common/covers/CoverFluidRegulator.java +++ b/src/main/java/gregtech/common/covers/CoverFluidRegulator.java @@ -91,17 +91,14 @@ public class CoverFluidRegulator extends CoverBehaviorBase 0) { tTank2 = aTileEntity.getITankContainerAtSide(side); tTank1 = (IFluidHandler) aTileEntity; directionFrom = side; - directionTo = side.getOpposite(); } else { tTank1 = aTileEntity.getITankContainerAtSide(side); tTank2 = (IFluidHandler) aTileEntity; directionFrom = side.getOpposite(); - directionTo = side; } if (tTank1 != null && tTank2 != null) { allowFluid = true; diff --git a/src/main/java/gregtech/common/covers/CoverPump.java b/src/main/java/gregtech/common/covers/CoverPump.java index 99d39dccad..15dd1fccfc 100644 --- a/src/main/java/gregtech/common/covers/CoverPump.java +++ b/src/main/java/gregtech/common/covers/CoverPump.java @@ -1,6 +1,6 @@ package gregtech.common.covers; -import java.util.Arrays; +import java.util.Collections; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.util.ForgeDirection; @@ -232,7 +232,7 @@ public class CoverPump extends CoverBehavior { }) .dynamicTooltip(() -> { ISerializableObject.LegacyCoverData coverData = getCoverData(); - return Arrays.asList( + return Collections.singletonList( coverData == null || coverData.get() % 2 == 0 ? GTUtility.trans("314", "Allow Input") : GTUtility.trans("312", "Allow Output")); @@ -249,7 +249,7 @@ public class CoverPump extends CoverBehavior { }) .dynamicTooltip(() -> { ISerializableObject.LegacyCoverData coverData = getCoverData(); - return Arrays.asList( + return Collections.singletonList( coverData == null || coverData.get() % 2 == 0 ? GTUtility.trans("313", "Block Input") : GTUtility.trans("311", "Block Output")); diff --git a/src/main/java/gregtech/common/covers/redstone/CoverWirelessDoesWorkDetector.java b/src/main/java/gregtech/common/covers/redstone/CoverWirelessDoesWorkDetector.java index ed55280b7f..54d71d2c8b 100644 --- a/src/main/java/gregtech/common/covers/redstone/CoverWirelessDoesWorkDetector.java +++ b/src/main/java/gregtech/common/covers/redstone/CoverWirelessDoesWorkDetector.java @@ -43,8 +43,7 @@ public class CoverWirelessDoesWorkDetector private static byte computeSignalBasedOnActivity(ActivityTransmitterData coverVariable, ICoverable tileEntity) { - if (tileEntity instanceof IMachineProgress) { - IMachineProgress mProgress = (IMachineProgress) tileEntity; + if (tileEntity instanceof IMachineProgress mProgress) { boolean inverted = coverVariable.invert; int signal = 0; diff --git a/src/main/java/gregtech/common/gui/modularui/widget/TextButtonWidget.java b/src/main/java/gregtech/common/gui/modularui/widget/TextButtonWidget.java index 492eef0a0a..a8aab5097e 100644 --- a/src/main/java/gregtech/common/gui/modularui/widget/TextButtonWidget.java +++ b/src/main/java/gregtech/common/gui/modularui/widget/TextButtonWidget.java @@ -8,8 +8,8 @@ import com.gtnewhorizons.modularui.common.widget.TextWidget; public class TextButtonWidget extends MultiChildWidget { - private ButtonWidget mButton; - private TextWidget mText; + private final ButtonWidget mButton; + private final TextWidget mText; private int leftMargin; diff --git a/src/main/java/gregtech/common/items/behaviors/BehaviourDataOrb.java b/src/main/java/gregtech/common/items/behaviors/BehaviourDataOrb.java index c5d045ecd0..12fcd41e3c 100644 --- a/src/main/java/gregtech/common/items/behaviors/BehaviourDataOrb.java +++ b/src/main/java/gregtech/common/items/behaviors/BehaviourDataOrb.java @@ -96,7 +96,7 @@ public class BehaviourDataOrb extends BehaviourNone { @Override public List getAdditionalToolTips(MetaBaseItem aItem, List aList, ItemStack aStack) { - if (!(getDataTitle(aStack).length() == 0)) { + if (!(getDataTitle(aStack).isEmpty())) { aList.add(getDataTitle(aStack)); aList.add(getDataName(aStack)); } diff --git a/src/main/java/gregtech/common/items/behaviors/BehaviourSwitchMode.java b/src/main/java/gregtech/common/items/behaviors/BehaviourSwitchMode.java index ba1730f805..af4fe13003 100644 --- a/src/main/java/gregtech/common/items/behaviors/BehaviourSwitchMode.java +++ b/src/main/java/gregtech/common/items/behaviors/BehaviourSwitchMode.java @@ -39,8 +39,7 @@ public class BehaviourSwitchMode extends BehaviourNone { @Override public List getAdditionalToolTips(MetaBaseItem aItem, List aList, ItemStack aStack) { super.getAdditionalToolTips(aItem, aList, aStack); - if ((aItem instanceof MetaGeneratedTool)) { - MetaGeneratedTool itemTool = (MetaGeneratedTool) aItem; + if ((aItem instanceof MetaGeneratedTool itemTool)) { final int maxMode = itemTool.getToolMaxMode(aStack); if (maxMode > 1) { aList.add("Shift+Rclick to change mode"); diff --git a/src/main/java/gregtech/common/render/BlackholeRenderer.java b/src/main/java/gregtech/common/render/BlackholeRenderer.java index 733bd3aa9e..2693844708 100644 --- a/src/main/java/gregtech/common/render/BlackholeRenderer.java +++ b/src/main/java/gregtech/common/render/BlackholeRenderer.java @@ -36,7 +36,7 @@ public class BlackholeRenderer extends TileEntitySpecialRenderer { private static IModelCustomExt blackholeModel; private static ResourceLocation blackholeTexture; - private static float modelScale = .5f; + private static final float modelScale = .5f; private ShaderProgram laserProgram; private static int u_LaserCameraPosition = -1, u_LaserColor = -1, u_LaserModelMatrix = -1; diff --git a/src/main/java/gregtech/common/render/FluidDisplayStackRenderer.java b/src/main/java/gregtech/common/render/FluidDisplayStackRenderer.java index 80e2cbe6a6..38d89b2da9 100644 --- a/src/main/java/gregtech/common/render/FluidDisplayStackRenderer.java +++ b/src/main/java/gregtech/common/render/FluidDisplayStackRenderer.java @@ -78,7 +78,7 @@ public class FluidDisplayStackRenderer implements IItemRenderer { String amountString; if (fluidAmount < 10_000) { - amountString = "" + fluidAmount + "L"; + amountString = fluidAmount + "L"; } else { amountString = ReadableNumberConverter.INSTANCE.toWideReadableForm(fluidAmount) + "L"; } diff --git a/src/main/java/gregtech/common/render/GTRendererBlock.java b/src/main/java/gregtech/common/render/GTRendererBlock.java index 1c8e2da29d..b4caab35b8 100644 --- a/src/main/java/gregtech/common/render/GTRendererBlock.java +++ b/src/main/java/gregtech/common/render/GTRendererBlock.java @@ -774,6 +774,6 @@ public class GTRendererBlock implements ISimpleBlockRenderingHandler { @Override public int getRenderId() { - return this.mRenderID; + return mRenderID; } } 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