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 --- .../GregtechMetaCasingBlocksPipeGearbox.java | 2 +- .../blocks/textures/TexturesGrinderMultiblock.java | 72 +++++++++++----------- .../turbine/LargeTurbineTextureHandler.java | 18 +++--- .../gregtech/common/covers/CoverToggleVisual.java | 7 +-- .../common/helpers/FlotationRecipeHandler.java | 2 +- .../common/helpers/tesseract/TesseractHelper.java | 17 +++-- .../gregtech/common/items/MetaCustomCoverItem.java | 20 +++--- .../items/behaviours/Behaviour_Choocher.java | 2 +- .../items/behaviours/Behaviour_Prospecting_Ex.java | 4 +- .../common/render/MachineBlockRenderer.java | 51 ++++++--------- .../automation/MTEElectricAutoWorkbench.java | 6 +- .../automation/MTETesseractGenerator.java | 31 +++------- .../automation/MTETesseractTerminal.java | 27 +++----- .../generators/MTEGeothermalGenerator.java | 2 +- .../tileentities/generators/MTERTGenerator.java | 2 +- .../generators/MTERocketFuelGenerator.java | 2 +- .../generators/MTESemiFluidGenerator.java | 2 +- .../basic/MTEAtmosphericReconditioner.java | 56 ++++++----------- .../tileentities/machines/basic/MTEAutoChisel.java | 22 +++---- .../machines/basic/MTECropHarvestor.java | 4 +- .../machines/basic/MTEPollutionCreator.java | 4 +- .../machines/basic/MTEPollutionDetector.java | 4 +- .../machines/basic/MTEWirelessCharger.java | 23 +++---- .../multi/processing/MTEIndustrialChisel.java | 2 +- .../multi/processing/MTEIndustrialDehydrator.java | 2 +- .../processing/MTEIndustrialVacuumFreezer.java | 2 +- .../machines/multi/processing/MTEIsaMill.java | 4 +- .../machines/multi/production/MTECyclotron.java | 2 +- .../multi/production/MTEElementalDuplicator.java | 4 +- .../multi/production/MTEFrothFlotationCell.java | 2 +- .../multi/production/MTEIndustrialRockBreaker.java | 2 +- .../multi/production/MTELargeRocketEngine.java | 12 ++-- .../multi/production/MTENuclearReactor.java | 2 +- .../machines/multi/production/MTERefinery.java | 2 +- .../machines/multi/production/MTESolarTower.java | 6 +- .../machines/multi/production/MTETreeFarm.java | 3 +- .../multi/production/algae/MTEAlgaePondBase.java | 4 +- .../production/chemplant/MTEChemicalPlant.java | 8 +-- .../production/turbines/MTELargeTurbineGas.java | 12 ++-- .../turbines/MTELargeTurbineSHSteam.java | 1 - .../production/turbines/MTELargeTurbineSteam.java | 1 - .../production/turbines/MTELargerTurbineBase.java | 21 +++---- .../turbines/MTELargerTurbinePlasma.java | 25 +++----- ...chMetaTileEntity_PowerSubStationController.java | 22 +++---- .../common/tileentities/misc/MTESolarHeater.java | 9 +-- .../redstone/MTERedstoneCircuitBlock.java | 11 ++-- .../tileentities/storage/MTETieredChest.java | 5 +- .../gregtech/common/tools/ToolAngleGrinder.java | 4 +- .../gregtech/common/tools/ToolElectricSnips.java | 2 +- 49 files changed, 224 insertions(+), 326 deletions(-) (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common') diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksPipeGearbox.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksPipeGearbox.java index 32f1f127d0..087e4fb056 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksPipeGearbox.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksPipeGearbox.java @@ -15,7 +15,7 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; public class GregtechMetaCasingBlocksPipeGearbox extends GregtechMetaCasingBlocksAbstract { - private static HashMap sMaterialMapping = new HashMap<>(); + private static final HashMap sMaterialMapping = new HashMap<>(); public GregtechMetaCasingBlocksPipeGearbox() { super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.pipesgears", MaterialCasings.INSTANCE); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java index 128e9c95d7..8208147236 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java @@ -13,43 +13,43 @@ import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.MT public class TexturesGrinderMultiblock { - private static CustomIcon GT8_1_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE1"); - private static CustomIcon GT8_1 = new CustomIcon("iconsets/Grinder/GRINDER1"); - private static CustomIcon GT8_2_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE2"); - private static CustomIcon GT8_2 = new CustomIcon("iconsets/Grinder/GRINDER2"); - private static CustomIcon GT8_3_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE3"); - private static CustomIcon GT8_3 = new CustomIcon("iconsets/Grinder/GRINDER3"); - private static CustomIcon GT8_4_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE4"); - private static CustomIcon GT8_4 = new CustomIcon("iconsets/Grinder/GRINDER4"); - private static CustomIcon GT8_5_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE5"); - private static CustomIcon GT8_5 = new CustomIcon("iconsets/Grinder/GRINDER5"); - private static CustomIcon GT8_6_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE6"); - private static CustomIcon GT8_6 = new CustomIcon("iconsets/Grinder/GRINDER6"); - private static CustomIcon GT8_7_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE7"); - private static CustomIcon GT8_7 = new CustomIcon("iconsets/Grinder/GRINDER7"); - private static CustomIcon GT8_8_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE8"); - private static CustomIcon GT8_8 = new CustomIcon("iconsets/Grinder/GRINDER8"); - private static CustomIcon GT8_9_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE9"); - private static CustomIcon GT8_9 = new CustomIcon("iconsets/Grinder/GRINDER9"); + private static final CustomIcon GT8_1_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE1"); + private static final CustomIcon GT8_1 = new CustomIcon("iconsets/Grinder/GRINDER1"); + private static final CustomIcon GT8_2_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE2"); + private static final CustomIcon GT8_2 = new CustomIcon("iconsets/Grinder/GRINDER2"); + private static final CustomIcon GT8_3_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE3"); + private static final CustomIcon GT8_3 = new CustomIcon("iconsets/Grinder/GRINDER3"); + private static final CustomIcon GT8_4_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE4"); + private static final CustomIcon GT8_4 = new CustomIcon("iconsets/Grinder/GRINDER4"); + private static final CustomIcon GT8_5_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE5"); + private static final CustomIcon GT8_5 = new CustomIcon("iconsets/Grinder/GRINDER5"); + private static final CustomIcon GT8_6_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE6"); + private static final CustomIcon GT8_6 = new CustomIcon("iconsets/Grinder/GRINDER6"); + private static final CustomIcon GT8_7_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE7"); + private static final CustomIcon GT8_7 = new CustomIcon("iconsets/Grinder/GRINDER7"); + private static final CustomIcon GT8_8_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE8"); + private static final CustomIcon GT8_8 = new CustomIcon("iconsets/Grinder/GRINDER8"); + private static final CustomIcon GT8_9_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE9"); + private static final CustomIcon GT8_9 = new CustomIcon("iconsets/Grinder/GRINDER9"); - private static CustomIcon frontFace_0 = (GT8_1); - private static CustomIcon frontFaceActive_0 = (GT8_1_Active); - private static CustomIcon frontFace_1 = (GT8_2); - private static CustomIcon frontFaceActive_1 = (GT8_2_Active); - private static CustomIcon frontFace_2 = (GT8_3); - private static CustomIcon frontFaceActive_2 = (GT8_3_Active); - private static CustomIcon frontFace_3 = (GT8_4); - private static CustomIcon frontFaceActive_3 = (GT8_4_Active); - private static CustomIcon frontFace_4 = (GT8_5); - private static CustomIcon frontFaceActive_4 = (GT8_5_Active); - private static CustomIcon frontFace_5 = (GT8_6); - private static CustomIcon frontFaceActive_5 = (GT8_6_Active); - private static CustomIcon frontFace_6 = (GT8_7); - private static CustomIcon frontFaceActive_6 = (GT8_7_Active); - private static CustomIcon frontFace_7 = (GT8_8); - private static CustomIcon frontFaceActive_7 = (GT8_8_Active); - private static CustomIcon frontFace_8 = (GT8_9); - private static CustomIcon frontFaceActive_8 = (GT8_9_Active); + private static final CustomIcon frontFace_0 = (GT8_1); + private static final CustomIcon frontFaceActive_0 = (GT8_1_Active); + private static final CustomIcon frontFace_1 = (GT8_2); + private static final CustomIcon frontFaceActive_1 = (GT8_2_Active); + private static final CustomIcon frontFace_2 = (GT8_3); + private static final CustomIcon frontFaceActive_2 = (GT8_3_Active); + private static final CustomIcon frontFace_3 = (GT8_4); + private static final CustomIcon frontFaceActive_3 = (GT8_4_Active); + private static final CustomIcon frontFace_4 = (GT8_5); + private static final CustomIcon frontFaceActive_4 = (GT8_5_Active); + private static final CustomIcon frontFace_5 = (GT8_6); + private static final CustomIcon frontFaceActive_5 = (GT8_6_Active); + private static final CustomIcon frontFace_6 = (GT8_7); + private static final CustomIcon frontFaceActive_6 = (GT8_7_Active); + private static final CustomIcon frontFace_7 = (GT8_8); + private static final CustomIcon frontFaceActive_7 = (GT8_8_Active); + private static final CustomIcon frontFace_8 = (GT8_9); + private static final CustomIcon frontFaceActive_8 = (GT8_9_Active); CustomIcon[] GRINDER = new CustomIcon[] { frontFace_0, frontFace_1, frontFace_2, frontFace_3, frontFace_4, frontFace_5, frontFace_6, frontFace_7, frontFace_8 }; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java index dea287fde6..e0acc6666d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java @@ -383,16 +383,12 @@ public class LargeTurbineTextureHandler { public static boolean isUsingAnimatedTexture(TileEntity tTileEntity) { boolean aVal = true; - IGregTechTileEntity aTile; - if (tTileEntity instanceof IGregTechTileEntity) { - aTile = (IGregTechTileEntity) tTileEntity; - if (aTile != null) { - final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity(); - if (aMetaTileEntity != null && aMetaTileEntity instanceof MTEHatchTurbine) { - aVal = ((MTEHatchTurbine) aMetaTileEntity).getBaseMetaTileEntity() - .isActive(); - // Logger.INFO("Returning "+aVal+" as Rotor Assembly controller status"); - } + if (tTileEntity instanceof IGregTechTileEntity aTile) { + final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity(); + if (aMetaTileEntity instanceof MTEHatchTurbine) { + aVal = aMetaTileEntity.getBaseMetaTileEntity() + .isActive(); + // Logger.INFO("Returning "+aVal+" as Rotor Assembly controller status"); } } return aVal; @@ -401,7 +397,7 @@ public class LargeTurbineTextureHandler { public static MTEHatchTurbine isTurbineHatch(final IGregTechTileEntity aTileEntity) { if (aTileEntity != null) { final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity != null && aMetaTileEntity instanceof MTEHatchTurbine) { + if (aMetaTileEntity instanceof MTEHatchTurbine) { return (MTEHatchTurbine) aMetaTileEntity; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverToggleVisual.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverToggleVisual.java index 2ba532d11f..891035f7ac 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverToggleVisual.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverToggleVisual.java @@ -31,8 +31,7 @@ public class CoverToggleVisual extends CoverBehavior { BlockPos aPos = new BlockPos( aEntity.getIGregTechTileEntity(aEntity.getXCoord(), aEntity.getYCoord(), aEntity.getZCoord())); - String s = aEntity.getInventoryName() + "." + aPos.getUniqueIdentifier() + side.name(); - return s; + return aEntity.getInventoryName() + "." + aPos.getUniqueIdentifier() + side.name(); } catch (Throwable t) {} XSTR x = new XSTR(); return "ERROR." + x.getSeed() + x.hashCode() + x.nextDouble() + ".ID"; @@ -168,10 +167,10 @@ public class CoverToggleVisual extends CoverBehavior { public static boolean getConnectionState(String aKey) { Integer b = sConnectionStateForEntityMap.get(aKey); // Logger.INFO("Get State: "+b+" | "+aKey); - return b != null ? b == VALUE_ON : false; + return b != null && b == VALUE_ON; } - public static final boolean getCoverConnections(final ItemStack aStack) { + public static boolean getCoverConnections(final ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("CustomCoverMeta"); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java index 773bf0127e..4ef2838542 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java @@ -46,7 +46,7 @@ public class FlotationRecipeHandler { } public static ItemStack findMilledStack(ItemStack[] aInputs) { - if (aInputs == null || aInputs.length <= 0) { + if (aInputs == null) { return null; } for (ItemStack aStack : aInputs) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java index 03a4ace32f..35de0d8cea 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java @@ -25,7 +25,7 @@ public class TesseractHelper { */ // Checks if a Generator is owned by a player. - public static final boolean isGeneratorOwnedByPlayer(EntityPlayer player, MTETesseractGenerator generator) { + public static boolean isGeneratorOwnedByPlayer(EntityPlayer player, MTETesseractGenerator generator) { if (player == null) { Logger.WARNING("Failed. [isGeneratorOwnedByPlayer]"); return false; @@ -50,7 +50,7 @@ public class TesseractHelper { } // Saves A Generator to the Players UUID map along with the Freq. - public static final boolean setGeneratorOwnershipByPlayer(EntityPlayer player, int freq, + public static boolean setGeneratorOwnershipByPlayer(EntityPlayer player, int freq, MTETesseractGenerator generator) { if (player == null) { return false; @@ -82,7 +82,7 @@ public class TesseractHelper { } // Gets Generator based on Frequency. - public static final MTETesseractGenerator getGeneratorByFrequency(EntityPlayer player, int freq) { + public static MTETesseractGenerator getGeneratorByFrequency(EntityPlayer player, int freq) { if (player == null) { return null; } @@ -107,7 +107,7 @@ public class TesseractHelper { } // Remove Tesseract Generator - public static final boolean removeGenerator(EntityPlayer player, int frequency) { + public static boolean removeGenerator(EntityPlayer player, int frequency) { if (player == null) { return false; } @@ -129,7 +129,7 @@ public class TesseractHelper { */ // Checks if a Terminal is owned by a player. - public static final boolean isTerminalOwnedByPlayer(EntityPlayer player, MTETesseractTerminal generator) { + public static boolean isTerminalOwnedByPlayer(EntityPlayer player, MTETesseractTerminal generator) { if (player == null) { return false; } @@ -148,8 +148,7 @@ public class TesseractHelper { } // Saves A Terminal to the Players UUID map along with the Freq. - public static final boolean setTerminalOwnershipByPlayer(EntityPlayer player, int freq, - MTETesseractTerminal generator) { + public static boolean setTerminalOwnershipByPlayer(EntityPlayer player, int freq, MTETesseractTerminal generator) { if (player == null) { return false; } @@ -178,7 +177,7 @@ public class TesseractHelper { } // Gets Terminal based on Frequency. - public static final MTETesseractTerminal getTerminalByFrequency(EntityPlayer player, int freq) { + public static MTETesseractTerminal getTerminalByFrequency(EntityPlayer player, int freq) { if (player == null) { return null; } @@ -200,7 +199,7 @@ public class TesseractHelper { } // Remove Tesseract Terminal - public static final boolean removeTerminal(EntityPlayer player, int frequency) { + public static boolean removeTerminal(EntityPlayer player, int frequency) { if (player == null) { return false; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java index a6cd63ca19..76b0ca91ea 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java @@ -18,7 +18,6 @@ import org.apache.commons.lang3.StringUtils; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTechAPI; import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.ITexture; import gregtech.api.objects.GTMultiTexture; import gregtech.api.objects.GTRenderedTexture; import gtPlusPlus.api.objects.Logger; @@ -74,7 +73,7 @@ public class MetaCustomCoverItem extends Item { } GregTechAPI.registerCover( thisStack, - new GTMultiTexture(new ITexture[] { new GTRenderedTexture(mTextures[i]) }), + new GTMultiTexture(new GTRenderedTexture(mTextures[i])), new CoverToggleVisual()); } } @@ -112,7 +111,7 @@ public class MetaCustomCoverItem extends Item { return true; } - public static final long getCoverDamage(final ItemStack aStack) { + public static long getCoverDamage(final ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("CustomCoverMeta"); @@ -125,7 +124,7 @@ public class MetaCustomCoverItem extends Item { return 0L; } - public static final boolean setCoverDamage(final ItemStack aStack, final long aDamage) { + public static boolean setCoverDamage(final ItemStack aStack, final long aDamage) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("CustomCoverMeta"); @@ -137,7 +136,7 @@ public class MetaCustomCoverItem extends Item { return false; } - public static final boolean getCoverConnections(final ItemStack aStack) { + public static boolean getCoverConnections(final ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("CustomCoverMeta"); @@ -150,7 +149,7 @@ public class MetaCustomCoverItem extends Item { return false; } - public static final boolean setCoverConnections(final ItemStack aStack, final boolean aConnections) { + public static boolean setCoverConnections(final ItemStack aStack, final boolean aConnections) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("CustomCoverMeta"); @@ -169,19 +168,14 @@ public class MetaCustomCoverItem extends Item { } double currentDamage = getCoverDamage(stack); double meta = stack.getItemDamage() == 0 ? 50 : 2500; - double durabilitypercent = currentDamage / meta; - return durabilitypercent; + return currentDamage / meta; } @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if (KeyboardUtils.isShiftKeyDown()) { boolean con = getCoverConnections(stack); - if (con) { - setCoverConnections(stack, false); - } else { - setCoverConnections(stack, true); - } + setCoverConnections(stack, !con); } return stack; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java index be7a0f1c99..5a1bb0eba5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java @@ -16,7 +16,7 @@ import gtPlusPlus.core.util.minecraft.PlayerUtils; public class Behaviour_Choocher extends BehaviourNone { - private boolean isWrench = true; + private final boolean isWrench = true; private final BehaviourWrench wrench = new BehaviourWrench(150); private final Behaviour_Prospecting_Ex prospecting = new Behaviour_Prospecting_Ex(10, 1250); private final String mTooltip1 = GTLanguageManager diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java index f63da57f1c..4196d399a1 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java @@ -68,9 +68,7 @@ public class Behaviour_Prospecting_Ex extends BehaviourProspecting { int tY = aY; int tZ = aZ; int tMetaID = 0; - final int tQuality = ((aItem instanceof MetaGeneratedTool) - ? ((MetaGeneratedTool) aItem).getHarvestLevel(aStack, "") - : 0) * 3; + final int tQuality = ((aItem instanceof MetaGeneratedTool) ? aItem.getHarvestLevel(aStack, "") : 0) * 3; int i = 0; for (final int j = 6 + tQuality; i < j; i++) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/render/MachineBlockRenderer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/render/MachineBlockRenderer.java index 7ce7002738..e39a6fcbba 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/render/MachineBlockRenderer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/render/MachineBlockRenderer.java @@ -232,21 +232,19 @@ public class MachineBlockRenderer extends GTRendererBlock { RenderBlocks aRenderer) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return tTileEntity instanceof ITexturedTileEntity - ? renderStandardBlock( - aWorld, - aX, - aY, - aZ, - aBlock, - aRenderer, - new ITexture[][] { GTMethodHelper.getTexture(tTileEntity, aBlock, DOWN), - GTMethodHelper.getTexture(tTileEntity, aBlock, UP), - GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.NORTH), - GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.SOUTH), - GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.WEST), - GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.EAST) }) - : false; + return tTileEntity instanceof ITexturedTileEntity && renderStandardBlock( + aWorld, + aX, + aY, + aZ, + aBlock, + aRenderer, + new ITexture[][] { GTMethodHelper.getTexture(tTileEntity, aBlock, DOWN), + GTMethodHelper.getTexture(tTileEntity, aBlock, UP), + GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.NORTH), + GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.SOUTH), + GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.WEST), + GTMethodHelper.getTexture(tTileEntity, aBlock, ForgeDirection.EAST) }); } public boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, @@ -1220,22 +1218,13 @@ public class MachineBlockRenderer extends GTRendererBlock { public boolean renderWorldBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, int aModelID, RenderBlocks aRenderer) { TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); - return aTileEntity == null ? false - : (aTileEntity instanceof IGregTechTileEntity - && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity() != null - && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity() - .renderInWorld(aWorld, aX, aY, aZ, aBlock, aRenderer) - ? true - : (aTileEntity instanceof IPipeRenderedTileEntity - ? renderPipeBlock( - aWorld, - aX, - aY, - aZ, - aBlock, - (IPipeRenderedTileEntity) aTileEntity, - aRenderer) - : renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer))); + return aTileEntity != null && (aTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity() != null + && ((IGregTechTileEntity) aTileEntity).getMetaTileEntity() + .renderInWorld(aWorld, aX, aY, aZ, aBlock, aRenderer) + || (aTileEntity instanceof IPipeRenderedTileEntity + ? renderPipeBlock(aWorld, aX, aY, aZ, aBlock, (IPipeRenderedTileEntity) aTileEntity, aRenderer) + : renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer))); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTEElectricAutoWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTEElectricAutoWorkbench.java index 05150c8478..73233b7938 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTEElectricAutoWorkbench.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTEElectricAutoWorkbench.java @@ -391,7 +391,9 @@ public class MTEElectricAutoWorkbench extends MTEBasicTank implements IAddGregte tTempStack.stackSize = 1; tRecipe[0] = tTempStack; tOutput = GTOreDictUnificator.get(true, tTempStack); - if (tOutput != null && GTUtility.areStacksEqual(tOutput, tTempStack)) tOutput = null; + if (GTUtility.areStacksEqual(tOutput, tTempStack)) { + tOutput = null; + } if (tOutput == null) { tRecipe[0] = null; if (mInventory[18] == null) { @@ -552,7 +554,7 @@ public class MTEElectricAutoWorkbench extends MTEBasicTank implements IAddGregte mInventory[28] = GTUtility.copy(tOutput); ArrayList tList = recipeContent(tRecipe), tContent = benchContent(); - if (tList.size() > 0 && tContent.size() > 0) { + if (!tList.isEmpty() && !tContent.isEmpty()) { boolean success = (mMode == 6 || mMode == 7 || mInventory[17] == null); for (byte i = 0; i < tList.size() && success; i++) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractGenerator.java index 08db4e19be..a48bcdace4 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractGenerator.java @@ -196,13 +196,10 @@ public class MTETesseractGenerator extends MTEBasicTank { .getOwnerName() != null && !this.getBaseMetaTileEntity() .getOwnerName() - .equals("")) { + .isEmpty()) { if (this.getBaseMetaTileEntity() .getOwnerName() - .toLowerCase() - .equals( - aPlayer.getDisplayName() - .toLowerCase())) { + .equalsIgnoreCase(aPlayer.getDisplayName())) { this.mOwner = PlayerUtils.getPlayersUUIDByName( this.getBaseMetaTileEntity() .getOwnerName()); @@ -684,8 +681,8 @@ public class MTETesseractGenerator extends MTEBasicTank { && (this.getBaseMetaTileEntity() .decreaseStoredEnergyUnits(this.mNeededEnergy, false))) { // Utils.LOG_WARNING("Can Work & Has Energy"); - if ((getGeneratorEntity(Integer.valueOf(this.mFrequency)) == null) - || (!getGeneratorEntity(Integer.valueOf(this.mFrequency)).isValidTesseractGenerator(null, true))) { + if ((getGeneratorEntity(this.mFrequency) == null) + || (!getGeneratorEntity(this.mFrequency).isValidTesseractGenerator(null, true))) { // Utils.LOG_WARNING("storing TE I think to mFreq map?"); TesseractHelper.setGeneratorOwnershipByPlayer( PlayerUtils.getPlayerOnServerFromUUID(mOwner), @@ -693,7 +690,7 @@ public class MTETesseractGenerator extends MTEBasicTank { this); } } else { - if (getGeneratorEntity(Integer.valueOf(this.mFrequency)) == this) { + if (getGeneratorEntity(this.mFrequency) == this) { Logger.WARNING("this gen == mFreq on map - do block update"); TesseractHelper.removeGenerator(PlayerUtils.getPlayerOnServerFromUUID(mOwner), this.mFrequency); this.getBaseMetaTileEntity() @@ -701,7 +698,7 @@ public class MTETesseractGenerator extends MTEBasicTank { } this.isWorking = 0; } - if (getGeneratorEntity(Integer.valueOf(this.mFrequency)) == this) { + if (getGeneratorEntity(this.mFrequency) == this) { // Utils.LOG_WARNING("mFreq == this - do work related things"); if (this.isWorking < 20) { this.isWorking = ((byte) (this.isWorking + 1)); @@ -789,21 +786,11 @@ public class MTETesseractGenerator extends MTEBasicTank { } private MTETesseractGenerator getGeneratorEntity() { - MTETesseractGenerator thisGenerator = TesseractHelper - .getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner), this.mFrequency); - if (thisGenerator != null) { - return thisGenerator; - } - return null; + return TesseractHelper.getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner), this.mFrequency); } private MTETesseractGenerator getGeneratorEntity(int frequency) { - MTETesseractGenerator thisGenerator = TesseractHelper - .getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner), frequency); - if (thisGenerator != null) { - return thisGenerator; - } - return null; + return TesseractHelper.getGeneratorByFrequency(PlayerUtils.getPlayerOnServerFromUUID(mOwner), frequency); } @Override @@ -812,7 +799,7 @@ public class MTETesseractGenerator extends MTEBasicTank { .getOwnerName() != null && !this.getBaseMetaTileEntity() .getOwnerName() - .equals("")) { + .isEmpty()) { this.mOwner = PlayerUtils.getPlayersUUIDByName( this.getBaseMetaTileEntity() .getOwnerName()); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractTerminal.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractTerminal.java index c34a2ca41b..1935129e32 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractTerminal.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/MTETesseractTerminal.java @@ -149,13 +149,10 @@ public class MTETesseractTerminal extends MTEBasicTank { .getOwnerName() != null && !this.getBaseMetaTileEntity() .getOwnerName() - .equals("")) { + .isEmpty()) { if (this.getBaseMetaTileEntity() .getOwnerName() - .toLowerCase() - .equals( - aPlayer.getDisplayName() - .toLowerCase())) { + .equalsIgnoreCase(aPlayer.getDisplayName())) { this.mOwner = PlayerUtils.getPlayersUUIDByName( this.getBaseMetaTileEntity() .getOwnerName()); @@ -194,11 +191,7 @@ public class MTETesseractTerminal extends MTEBasicTank { } PlayerUtils.messagePlayer(aPlayer, "Frequency: " + this.mFrequency); if (this.getTesseract(this.mFrequency, false) != null) { - PlayerUtils.messagePlayer( - aPlayer, - new StringBuilder().append(EnumChatFormatting.GREEN) - .append(" (Connected)") - .toString()); + PlayerUtils.messagePlayer(aPlayer, EnumChatFormatting.GREEN + " (Connected)"); } } } else if (aPlayer.getUniqueID() @@ -250,9 +243,7 @@ public class MTETesseractTerminal extends MTEBasicTank { aPlayer, "Frequency: " + this.mFrequency + (this.getTesseract(this.mFrequency, false) == null ? "" - : new StringBuilder().append(EnumChatFormatting.GREEN) - .append(" (Connected)") - .toString())); + : EnumChatFormatting.GREEN + " (Connected)")); } } else if (aPlayer.getUniqueID() .compareTo(this.mOwner) != 0) { @@ -275,10 +266,8 @@ public class MTETesseractTerminal extends MTEBasicTank { return null; } if (rTesseract.mFrequency != aFrequency) { - TesseractHelper.setTerminalOwnershipByPlayer( - PlayerUtils.getPlayerOnServerFromUUID(mOwner), - Integer.valueOf(aFrequency), - null); + TesseractHelper + .setTerminalOwnershipByPlayer(PlayerUtils.getPlayerOnServerFromUUID(mOwner), aFrequency, null); return null; } if (!rTesseract.isValidTesseractGenerator( @@ -539,7 +528,7 @@ public class MTETesseractTerminal extends MTEBasicTank { this.getBaseMetaTileEntity() .decreaseStoredEnergyUnits(128, false); } - } else if (this.mDidWork == true) { + } else if (this.mDidWork) { this.mDidWork = false; this.getBaseMetaTileEntity() .issueBlockUpdate(); @@ -623,7 +612,7 @@ public class MTETesseractTerminal extends MTEBasicTank { .getOwnerName() != null && !this.getBaseMetaTileEntity() .getOwnerName() - .equals("")) { + .isEmpty()) { this.mOwner = PlayerUtils.getPlayersUUIDByName( this.getBaseMetaTileEntity() .getOwnerName()); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTEGeothermalGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTEGeothermalGenerator.java index e84f4763cf..e1fc5c57f0 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTEGeothermalGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTEGeothermalGenerator.java @@ -27,7 +27,7 @@ public class MTEGeothermalGenerator extends MTEBasicGenerator { public int mEfficiency; public MTEGeothermalGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires Pahoehoe Lava or Normal Lava as Fuel", new ITexture[0]); + super(aID, aName, aNameRegional, aTier, "Requires Pahoehoe Lava or Normal Lava as Fuel"); this.setEfficiency(); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERTGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERTGenerator.java index 9b51724b35..9f70912cad 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERTGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERTGenerator.java @@ -169,7 +169,7 @@ public class MTERTGenerator extends MTEBasicGenerator { } public MTERTGenerator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires RTG Pellets", new ITexture[0]); + super(aID, aName, aNameRegional, aTier, "Requires RTG Pellets"); } private byte getTier() { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERocketFuelGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERocketFuelGenerator.java index 48c3a63007..3565ac831b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERocketFuelGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTERocketFuelGenerator.java @@ -21,7 +21,7 @@ public class MTERocketFuelGenerator extends MTERocketFuelGeneratorBase { public int mEfficiency; public MTERocketFuelGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires GT++ Rocket Fuels", new ITexture[0]); + super(aID, aName, aNameRegional, aTier, "Requires GT++ Rocket Fuels"); } public MTERocketFuelGenerator(final String aName, final int aTier, final String[] aDescription, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTESemiFluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTESemiFluidGenerator.java index 49c9523612..d499093247 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTESemiFluidGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/MTESemiFluidGenerator.java @@ -27,7 +27,7 @@ public class MTESemiFluidGenerator extends MTEBasicGenerator { public int mEfficiency; public MTESemiFluidGenerator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Requires semifluid Fuel", new ITexture[0]); + super(aID, aName, aNameRegional, aTier, "Requires semifluid Fuel"); this.mEfficiency = 100 - (this.mTier * 5); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAtmosphericReconditioner.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAtmosphericReconditioner.java index 6988d2f43b..438fe6a536 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAtmosphericReconditioner.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAtmosphericReconditioner.java @@ -68,14 +68,14 @@ public class MTEAtmosphericReconditioner extends MTEBasicMachine { "Making sure you don't live in Gwalior - Uses 2A", 3, 0, - new ITexture[] { new GTRenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE), - new GTRenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB), - new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active), - new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab), - new GTRenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast), - new GTRenderedTexture(TexturesGtBlock.Overlay_Machine_Vent), - new GTRenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE), - new GTRenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB) }); + new GTRenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE), + new GTRenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB), + new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active), + new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab), + new GTRenderedTexture(TexturesGtBlock.Overlay_Machine_Vent_Fast), + new GTRenderedTexture(TexturesGtBlock.Overlay_Machine_Vent), + new GTRenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE), + new GTRenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB)); mPollutionEnabled = GTMod.gregtechproxy.mPollution; } @@ -264,8 +264,7 @@ public class MTEAtmosphericReconditioner extends MTEBasicMachine { Logger.INFO("mOptimalAirFlow[1]:" + mOptimalAirFlow); // Calculate The Voltage we are running - long tVoltage = drainEU; - byte tTier = (byte) Math.max(1, GTUtility.getTier(tVoltage)); + byte tTier = (byte) Math.max(1, GTUtility.getTier(drainEU)); // Check Sides for Air, // More air means more pollution processing. @@ -295,15 +294,8 @@ public class MTEAtmosphericReconditioner extends MTEBasicMachine { Logger.INFO("mCurrentPollution[4]:" + mCurrentPollution); Logger.INFO("mCurrentPollution[5]:" + reduction); - if (reduction <= mCurrentPollution) { - // Clean some Air. - toRemove = reduction; - } else { - // Makes sure we don't get negative pollution. - toRemove = mCurrentPollution; - } - - toRemove = toRemove / 2; + + toRemove = Math.min(reduction, mCurrentPollution) / 2; Logger.INFO("mCurrentPollution[6]:" + toRemove); // We are good to clean @@ -391,21 +383,13 @@ public class MTEAtmosphericReconditioner extends MTEBasicMachine { mCurrentChunkPollution += getPollutionInChunk(r); } } - if (mCurrentChunkPollution > 0) { - mHasPollution = true; - } else { - mHasPollution = false; - } + mHasPollution = mCurrentChunkPollution > 0; return mCurrentChunkPollution; } public int getPollutionInChunk(Chunk aChunk) { int mCurrentChunkPollution = PollutionUtils.getPollution(aChunk); - if (mCurrentChunkPollution > 0) { - mHasPollution = true; - } else { - mHasPollution = false; - } + mHasPollution = mCurrentChunkPollution > 0; return mCurrentChunkPollution; } @@ -573,9 +557,8 @@ public class MTEAtmosphericReconditioner extends MTEBasicMachine { public boolean removePollution(int toRemove) { - if (this == null || this.getBaseMetaTileEntity() == null - || this.getBaseMetaTileEntity() - .getWorld() == null) { + if (this.getBaseMetaTileEntity() == null || this.getBaseMetaTileEntity() + .getWorld() == null) { return false; } @@ -740,10 +723,8 @@ public class MTEAtmosphericReconditioner extends MTEBasicMachine { if (aStack.getItem() instanceof ItemBasicScrubberTurbine) { return true; } - if (aStack.getItem() instanceof MetaGeneratedTool && aStack.getItemDamage() >= 170 - && aStack.getItemDamage() <= 179) { - return true; - } + return aStack.getItem() instanceof MetaGeneratedTool && aStack.getItemDamage() >= 170 + && aStack.getItemDamage() <= 179; } } return false; @@ -765,8 +746,7 @@ public class MTEAtmosphericReconditioner extends MTEBasicMachine { @Override public String[] getInfoData() { - ArrayList aTooltipSuper = new ArrayList<>(); - aTooltipSuper.addAll(Arrays.asList(super.getInfoData())); + ArrayList aTooltipSuper = new ArrayList<>(Arrays.asList(super.getInfoData())); int mAirSides = getFreeSpaces(); int reduction = 0; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAutoChisel.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAutoChisel.java index 6cdc97130b..b4f69323f4 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAutoChisel.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEAutoChisel.java @@ -40,14 +40,14 @@ public class MTEAutoChisel extends MTEBasicMachine { "Chisels things, Gregtech style", 1, 1, - new ITexture[] { new GTRenderedTexture(BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE), - new GTRenderedTexture(BlockIcons.OVERLAY_SIDE_MASSFAB), - new GTRenderedTexture(BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE), - new GTRenderedTexture(BlockIcons.OVERLAY_FRONT_MULTI_SMELTER), - new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active), - new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab), - new GTRenderedTexture(BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE), - new GTRenderedTexture(BlockIcons.OVERLAY_BOTTOM_MASSFAB) }); + new GTRenderedTexture(BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE), + new GTRenderedTexture(BlockIcons.OVERLAY_SIDE_MASSFAB), + new GTRenderedTexture(BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE), + new GTRenderedTexture(BlockIcons.OVERLAY_FRONT_MULTI_SMELTER), + new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active), + new GTRenderedTexture(TexturesGtBlock.Overlay_MatterFab), + new GTRenderedTexture(BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE), + new GTRenderedTexture(BlockIcons.OVERLAY_BOTTOM_MASSFAB)); } public MTEAutoChisel(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { @@ -90,8 +90,8 @@ public class MTEAutoChisel extends MTEBasicMachine { @Override protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - return hasValidCache(aStack, this.getSpecialSlot(), false) ? true - : super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack) && hasChiselResults(aStack); + return hasValidCache(aStack, this.getSpecialSlot(), false) + || super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack) && hasChiselResults(aStack); } // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target @@ -108,7 +108,7 @@ public class MTEAutoChisel extends MTEBasicMachine { // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target private static boolean hasChiselResults(ItemStack from) { List results = getItemsForChiseling(from); - return results.size() > 0; + return !results.isEmpty(); } private static List getItemsForChiseling(ItemStack aStack) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTECropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTECropHarvestor.java index 9788abcf0c..f1f129606f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTECropHarvestor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTECropHarvestor.java @@ -164,7 +164,7 @@ public class MTECropHarvestor extends MTEBasicTank { }; } - private HashSet mCropCache = new HashSet<>(); + private final HashSet mCropCache = new HashSet<>(); private boolean mInvalidCache = false; public boolean doesInventoryHaveSpace() { @@ -213,7 +213,7 @@ public class MTECropHarvestor extends MTEBasicTank { for (int x = (-aSide); x <= aSide; x++) { for (int z = (-aSide); z <= aSide; z++) { TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(x, y, z); - if (tTileEntity != null && tTileEntity instanceof ICropTile tCrop) { + if (tTileEntity instanceof ICropTile tCrop) { this.mCropCache.add(tCrop); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionCreator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionCreator.java index 2521fb703f..0226214c44 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionCreator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionCreator.java @@ -22,10 +22,10 @@ public class MTEPollutionCreator extends GTPPMetaTileEntity { int mCurrentPollution; int mAveragePollution; - int mAveragePollutionArray[] = new int[10]; + int[] mAveragePollutionArray = new int[10]; private int mArrayPos = 0; private int mTickTimer = 0; - private int mSecondTimer = 0; + private final int mSecondTimer = 0; public MTEPollutionCreator(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionDetector.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionDetector.java index 747663f4cb..87e18931b5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionDetector.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEPollutionDetector.java @@ -24,10 +24,10 @@ public class MTEPollutionDetector extends GTPPMetaTileEntity { int mCurrentPollution; int mAveragePollution; - int mAveragePollutionArray[] = new int[10]; + int[] mAveragePollutionArray = new int[10]; private int mArrayPos = 0; private int mTickTimer = 0; - private int mSecondTimer = 0; + private final int mSecondTimer = 0; private long mRedstoneLevel = 0; public MTEPollutionDetector(final int aID, final String aName, final String aNameRegional, final int aTier, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEWirelessCharger.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEWirelessCharger.java index 1535140115..739a098331 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEWirelessCharger.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/MTEWirelessCharger.java @@ -323,9 +323,7 @@ public class MTEWirelessCharger extends GTPPMetaTileEntity { @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } + aBaseMetaTileEntity.isClientSide(); return true; } @@ -449,18 +447,14 @@ public class MTEWirelessCharger extends GTPPMetaTileEntity { super.onFirstTick(aBaseMetaTileEntity); } - private Map mWirelessChargingMap = new HashMap<>(); - private Map mLocalChargingMap = new HashMap<>(); + private final Map mWirelessChargingMap = new HashMap<>(); + private final Map mLocalChargingMap = new HashMap<>(); private boolean isValidPlayer(EntityPlayer aPlayer) { BaseMetaTileEntity aTile = (BaseMetaTileEntity) this.getBaseMetaTileEntity(); if (mLocked || (aTile != null && aTile.privateAccess())) { - if (aPlayer.getUniqueID() - .equals(getBaseMetaTileEntity().getOwnerUuid())) { - return true; - } else { - return false; - } + return aPlayer.getUniqueID() + .equals(getBaseMetaTileEntity().getOwnerUuid()); } return true; } @@ -579,11 +573,10 @@ public class MTEWirelessCharger extends GTPPMetaTileEntity { int[] objectArray1 = new int[] { objectA.xPos, objectA.yPos, objectA.zPos }; int[] objectArray2 = new int[] { objectB.xPos, objectB.yPos, objectB.zPos }; - final double distance = Math.sqrt( + return Math.sqrt( (objectArray2[0] - objectArray1[0]) * (objectArray2[0] - objectArray1[0]) + (objectArray2[1] - objectArray1[1]) * (objectArray2[1] - objectArray1[1]) + (objectArray2[2] - objectArray1[2]) * (objectArray2[2] - objectArray1[2])); - return distance; } @Override @@ -636,7 +629,7 @@ public class MTEWirelessCharger extends GTPPMetaTileEntity { PlayerUtils.messagePlayer(aPlayer, "Players with access:"); for (String name : this.getLocalMap() .keySet()) { - PlayerUtils.messagePlayer(aPlayer, "" + name); + PlayerUtils.messagePlayer(aPlayer, name); } } else { @@ -644,7 +637,7 @@ public class MTEWirelessCharger extends GTPPMetaTileEntity { PlayerUtils.messagePlayer(aPlayer, "Players with access:"); for (String name : this.getLongRangeMap() .keySet()) { - PlayerUtils.messagePlayer(aPlayer, "" + name); + PlayerUtils.messagePlayer(aPlayer, name); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialChisel.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialChisel.java index 40a497fa06..d68fe3f8c7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialChisel.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialChisel.java @@ -195,7 +195,7 @@ public class MTEIndustrialChisel extends GTPPMultiBlockBase // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target private static boolean hasChiselResults(ItemStack from) { List results = getItemsForChiseling(from); - return results.size() > 0; + return !results.isEmpty(); } private static List getItemsForChiseling(ItemStack aStack) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java index eb7e6baa9c..8b63f34edb 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialDehydrator.java @@ -62,7 +62,7 @@ public class MTEIndustrialDehydrator extends GTPPMultiBlockBase implements ISurvi if (!aEntities.isEmpty()) { for (EntityLivingBase aFoundEntity : aEntities) { if (aFoundEntity instanceof EntityPlayer aPlayer) { - if (PlayerUtils.isCreative(aPlayer) || !PlayerUtils.canTakeDamage(aPlayer)) { - continue; - } else { + if (!PlayerUtils.isCreative(aPlayer) && PlayerUtils.canTakeDamage(aPlayer)) { if (aFoundEntity.getHealth() > 0) { EntityUtils.doDamage(aFoundEntity, mIsaMillDamageSource, getPlayerDamageValue(aPlayer, 10)); if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive())) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTECyclotron.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTECyclotron.java index 4c313a3be3..6952dd5c24 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTECyclotron.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTECyclotron.java @@ -264,7 +264,7 @@ public class MTECyclotron extends GTPPMultiBlockBase implements IS @Override public boolean onRunningTick(ItemStack aStack) { - if (this.mOutputBusses.size() > 0) { + if (!this.mOutputBusses.isEmpty()) { for (MTEHatchOutputBus g : this.mOutputBusses) { if (g != null) { for (ItemStack s : g.mInventory) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEElementalDuplicator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEElementalDuplicator.java index a241238e42..32ea79cc55 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEElementalDuplicator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEElementalDuplicator.java @@ -152,7 +152,7 @@ public class MTEElementalDuplicator extends GTPPMultiBlockBase x.mReplicatorDataOrbHatches.size() >= 1) + .shouldReject(x -> !x.mReplicatorDataOrbHatches.isEmpty()) .adder(MTEElementalDuplicator::addDataOrbHatch) .casingIndex(getCasingTextureIndex()) .dot(1) @@ -172,7 +172,7 @@ public class MTEElementalDuplicator extends GTPPMultiBlockBase