diff options
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities')
37 files changed, 136 insertions, 213 deletions
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<ItemStack> 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<String> aTooltipSuper = new ArrayList<>(); - aTooltipSuper.addAll(Arrays.asList(super.getInfoData())); + ArrayList<String> 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<ItemStack> results = getItemsForChiseling(from); - return results.size() > 0; + return !results.isEmpty(); } private static List<ItemStack> 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<ICropTile> mCropCache = new HashSet<>(); + private final HashSet<ICropTile> 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<String, UUID> mWirelessChargingMap = new HashMap<>(); - private Map<String, UUID> mLocalChargingMap = new HashMap<>(); + private final Map<String, UUID> mWirelessChargingMap = new HashMap<>(); + private final Map<String, UUID> 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<MTEIndustrialChisel> // 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<ItemStack> results = getItemsForChiseling(from); - return results.size() > 0; + return !results.isEmpty(); } private static List<ItemStack> 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<MTEIndustrialDeh implements ISurvivalConstructable { private static int CASING_TEXTURE_ID; - private static String mCasingName = "Vacuum Casing"; + private static final String mCasingName = "Vacuum Casing"; private HeatingCoilLevel mHeatingCapacity; private boolean mDehydratorMode = false; private int mCasing; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialVacuumFreezer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialVacuumFreezer.java index 8d543b7bcc..563b844574 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialVacuumFreezer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIndustrialVacuumFreezer.java @@ -72,7 +72,7 @@ public class MTEIndustrialVacuumFreezer extends GTPPMultiBlockBase<MTEIndustrial @Override public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return (IMetaTileEntity) new MTEIndustrialVacuumFreezer(this.mName); + return new MTEIndustrialVacuumFreezer(this.mName); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIsaMill.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIsaMill.java index 0df9417f32..5634b5f1d6 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIsaMill.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/MTEIsaMill.java @@ -256,9 +256,7 @@ public class MTEIsaMill extends GTPPMultiBlockBase<MTEIsaMill> 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<MTECyclotron> 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<MTEElementalDupli .build(), buildHatchAdder(MTEElementalDuplicator.class) .hatchClass(MTEHatchElementalDataOrbHolder.class) - .shouldReject(x -> 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<MTEElementalDupli public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mCasing = 0; boolean aDidBuild = checkPiece(STRUCTURE_PIECE_MAIN, 4, 4, 0); - if (this.mInputHatches.size() != 1 || (this.mOutputBusses.size() != 1 && this.mOutputHatches.size() != 0) + if (this.mInputHatches.size() != 1 || (this.mOutputBusses.size() != 1 && !this.mOutputHatches.isEmpty()) || this.mEnergyHatches.size() != 1 || this.mReplicatorDataOrbHatches.size() != 1) { return false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEFrothFlotationCell.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEFrothFlotationCell.java index f4e9bac434..bbcbfc1322 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEFrothFlotationCell.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEFrothFlotationCell.java @@ -276,7 +276,7 @@ public class MTEFrothFlotationCell extends GTPPMultiBlockBase<MTEFrothFlotationC @Override public boolean isRecipeLockingEnabled() { - return lockedMaterialName != null && !lockedMaterialName.equals(""); + return lockedMaterialName != null && !lockedMaterialName.isEmpty(); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialRockBreaker.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialRockBreaker.java index c3bf843fd3..ee62f45ef8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialRockBreaker.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEIndustrialRockBreaker.java @@ -144,7 +144,7 @@ public class MTEIndustrialRockBreaker extends GTPPMultiBlockBase<MTEIndustrialRo boolean aCheckPiece = checkPiece(mName, 1, 3, 0); boolean aCasingCount = mCasing >= 9; boolean aCheckHatch = checkHatch(); - log("" + aCheckPiece + ", " + aCasingCount + ", " + aCheckHatch); + log(aCheckPiece + ", " + aCasingCount + ", " + aCheckHatch); return aCheckPiece && aCasingCount && aCheckHatch; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTELargeRocketEngine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTELargeRocketEngine.java index f2ddecb687..b9e1d7858c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTELargeRocketEngine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTELargeRocketEngine.java @@ -132,8 +132,8 @@ public class MTELargeRocketEngine extends GTPPMultiBlockBase<MTELargeRocketEngin @Override public IStructureDefinition<MTELargeRocketEngine> getStructureDefinition() { - if (this.STRUCTURE_DEFINITION == null) { - this.STRUCTURE_DEFINITION = StructureDefinition.<MTELargeRocketEngine>builder() + if (STRUCTURE_DEFINITION == null) { + STRUCTURE_DEFINITION = StructureDefinition.<MTELargeRocketEngine>builder() .addShape( this.mName, transpose( @@ -161,7 +161,7 @@ public class MTELargeRocketEngine extends GTPPMultiBlockBase<MTELargeRocketEngin .addElement('M', Muffler.newAny(getCasingTextureIndex(), 3)) .build(); } - return this.STRUCTURE_DEFINITION; + return STRUCTURE_DEFINITION; } @Override @@ -182,7 +182,7 @@ public class MTELargeRocketEngine extends GTPPMultiBlockBase<MTELargeRocketEngin this.mAllDynamoHatches.clear(); this.mAirIntakes.clear(); return checkPiece(this.mName, 1, 1, 0) && this.mCasing >= 64 - 48 - && this.mAirIntakes.size() >= 1 + && !this.mAirIntakes.isEmpty() && checkHatch(); } @@ -270,7 +270,7 @@ public class MTELargeRocketEngine extends GTPPMultiBlockBase<MTELargeRocketEngin // reset fuel ticks in case it does not reset when it stops if (this.freeFuelTicks != 0 && this.mProgresstime == 0 && this.mEfficiency == 0) this.freeFuelTicks = 0; - if (tFluids.size() > 0 && getRecipeMap() != null) { + if (!tFluids.isEmpty() && getRecipeMap() != null) { if (this.mRuntime % 72 == 0) { if (!consumeCO2()) { this.freeFuelTicks = 0; @@ -375,7 +375,7 @@ public class MTELargeRocketEngine extends GTPPMultiBlockBase<MTELargeRocketEngin if (aEU <= 0) { return true; } - if (this.mAllDynamoHatches.size() > 0) { + if (!this.mAllDynamoHatches.isEmpty()) { return addEnergyOutputMultipleDynamos(aEU, true); } return false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTENuclearReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTENuclearReactor.java index 3da77cf783..31caefe8f2 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTENuclearReactor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTENuclearReactor.java @@ -261,7 +261,7 @@ public class MTENuclearReactor extends GTPPMultiBlockBase<MTENuclearReactor> imp public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mCasing = 0; if (checkPiece(mName, 3, 3, 0) && mCasing >= 27) { - if ((mOutputHatches.size() >= 3 || canDumpFluidToME()) && mInputHatches.size() >= 1 + if ((mOutputHatches.size() >= 3 || canDumpFluidToME()) && !mInputHatches.isEmpty() && mDynamoHatches.size() == 4 && mMufflerHatches.size() == 4) { this.turnCasingActive(false); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTERefinery.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTERefinery.java index f7f992e191..9b28387849 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTERefinery.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTERefinery.java @@ -175,7 +175,7 @@ public class MTERefinery extends GTPPMultiBlockBase<MTERefinery> implements ISur mCasing = 0; if (checkPiece(mName, 1, 7, 0) && mCasing >= 7) { if (this.mInputHatches.size() >= 2 && this.mInputHatches.size() <= 4 - && this.mOutputHatches.size() >= 1 + && !this.mOutputHatches.isEmpty() && this.mOutputHatches.size() <= 2 && this.mMufflerHatches.size() == 1 && this.mMaintenanceHatches.size() == 1 diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTESolarTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTESolarTower.java index 085cb1b784..31ed44d5a3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTESolarTower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTESolarTower.java @@ -281,8 +281,8 @@ public class MTESolarTower extends GTPPMultiBlockBase<MTESolarTower> implements boolean aAllCasings = aCasingCount1 && aCasingCount2 && aCasingCount3 && aCasingCount4; if (!aAllCasings || !aAllStructure || mMaintenanceHatches.size() != 1 - || mInputHatches.size() < 1 - || mOutputHatches.size() < 1) { + || mInputHatches.isEmpty() + || mOutputHatches.isEmpty()) { log( "Bad Hatches - Solar Heaters: " + mSolarHeaters.size() + ", Maint: " @@ -486,7 +486,7 @@ public class MTESolarTower extends GTPPMultiBlockBase<MTESolarTower> implements // log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size()); } } - return mSolarHeaters.size() > 0; + return !mSolarHeaters.isEmpty(); } private boolean addSolarHeater(IGregTechTileEntity aTileEntity, int a) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java index bb5754bef7..5478014c62 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTETreeFarm.java @@ -266,8 +266,7 @@ public class MTETreeFarm extends GTPPMultiBlockBase<MTETreeFarm> implements ISur * In previous versions, a saw used to go in the controller slot. We do not want an update to stop processing of * a machine set up like this. Instead, a sapling is placed in this slot at the start of the next operation. */ - if (aStack.getItem() instanceof MetaGeneratedTool01) return true; - return false; + return aStack.getItem() instanceof MetaGeneratedTool01; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/MTEAlgaePondBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/MTEAlgaePondBase.java index 49e9878bec..6b266908ce 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/MTEAlgaePondBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/MTEAlgaePondBase.java @@ -183,8 +183,8 @@ public class MTEAlgaePondBase extends GTPPMultiBlockBase<MTEAlgaePondBase> imple if (checkPiece(mName, 4, 2, 0) && mCasing >= 64 && checkMeta > 0 - && mInputHatches.size() >= 1 - && mOutputBusses.size() >= 1) { + && !mInputHatches.isEmpty() + && !mOutputBusses.isEmpty()) { mLevel = checkMeta - 1; for (MTEHatchInput inputHatch : mInputHatches) { if (inputHatch.mTier < mLevel) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/MTEChemicalPlant.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/MTEChemicalPlant.java index a6794809ef..1e5d1bb9ea 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/MTEChemicalPlant.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/MTEChemicalPlant.java @@ -80,7 +80,7 @@ public class MTEChemicalPlant extends GTPPMultiBlockBase<MTEChemicalPlant> imple private int mPipeCasingTier = 0; private int mCoilTier = 0; private HeatingCoilLevel checkCoil; - private int[] checkCasing = new int[8]; + private final int[] checkCasing = new int[8]; private int checkMachine; private int checkPipe; private int maxTierOfHatch; @@ -114,10 +114,8 @@ public class MTEChemicalPlant extends GTPPMultiBlockBase<MTEChemicalPlant> imple if (!mTieredBlockRegistry.containsKey(aTier)) { return 10; } - int aCasingID = mTieredBlockRegistry.get(aTier) + return mTieredBlockRegistry.get(aTier) .getValue_3(); - // Logger.INFO("Found casing texture ID "+aCasingID+" for tier "+aTier); - return aCasingID; } @Override @@ -216,7 +214,7 @@ public class MTEChemicalPlant extends GTPPMultiBlockBase<MTEChemicalPlant> imple .dot(1) .build(), buildHatchAdder(MTEChemicalPlant.class).hatchClass(MTEHatchCatalysts.class) - .shouldReject(t -> t.mCatalystBuses.size() >= 1) + .shouldReject(t -> !t.mCatalystBuses.isEmpty()) .adder(MTEChemicalPlant::addChemicalPlantList) .casingIndex(getCasingTextureID()) .dot(1) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineGas.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineGas.java index 93ec17e6ea..1e44eb95c3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineGas.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineGas.java @@ -25,7 +25,6 @@ import gregtech.api.util.GTRecipe; import gregtech.api.util.GTUtility; import gregtech.api.util.TurbineStatCalculator; -@SuppressWarnings("deprecation") public class MTELargeTurbineGas extends MTELargerTurbineBase { private static final HashSet<Fluid> BLACKLIST = new HashSet<>(); @@ -110,7 +109,7 @@ public class MTELargeTurbineGas extends MTELargerTurbineBase { @Override long fluidIntoPower(ArrayList<FluidStack> aFluids, TurbineStatCalculator turbine) { - if (aFluids.size() >= 1) { + if (!aFluids.isEmpty()) { int tEU = 0; int actualOptimalFlow = 0; FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. @@ -153,15 +152,12 @@ public class MTELargeTurbineGas extends MTELargerTurbineBase { if (totalFlow <= 0) return 0; tEU = GTUtility.safeInt((long) totalFlow * fuelValue); - if (totalFlow == actualOptimalFlow) { - tEU = GTUtility.safeInt( - (long) (tEU * (isLooseMode() ? turbine.getLooseGasEfficiency() : turbine.getGasEfficiency()))); - } else { + if (totalFlow != actualOptimalFlow) { float efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow); tEU *= efficiency; - tEU = GTUtility.safeInt( - (long) (tEU * (isLooseMode() ? turbine.getLooseGasEfficiency() : turbine.getGasEfficiency()))); } + tEU = GTUtility + .safeInt((long) (tEU * (isLooseMode() ? turbine.getLooseGasEfficiency() : turbine.getGasEfficiency()))); return tEU; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSHSteam.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSHSteam.java index 25650fad08..5fbcb237fd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSHSteam.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSHSteam.java @@ -14,7 +14,6 @@ import gregtech.api.util.TurbineStatCalculator; import gtPlusPlus.core.lib.GTPPCore; import gtPlusPlus.core.util.math.MathUtils; -@SuppressWarnings("deprecation") public class MTELargeTurbineSHSteam extends MTELargerTurbineBase { public boolean achievement = false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSteam.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSteam.java index 0de134950c..beeaa2726b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSteam.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargeTurbineSteam.java @@ -14,7 +14,6 @@ import gregtech.api.util.GTModHandler; import gregtech.api.util.TurbineStatCalculator; import gtPlusPlus.core.util.math.MathUtils; -@SuppressWarnings("deprecation") public class MTELargeTurbineSteam extends MTELargerTurbineBase { private float water; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbineBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbineBase.java index dc2f105bbb..fa9d60fb11 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbineBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbineBase.java @@ -214,11 +214,11 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT boolean aStructure = checkPiece(STRUCTURE_PIECE_MAIN, 3, 3, 0); log("Structure Check: " + aStructure); if (mTurbineRotorHatches.size() != 12 || mMaintenanceHatches.size() != 1 - || (mDynamoHatches.size() < 1 && mTecTechDynamoHatches.size() < 1) + || (mDynamoHatches.isEmpty() && mTecTechDynamoHatches.isEmpty()) || (requiresMufflers() && mMufflerHatches.size() != 4) - || mInputBusses.size() < 1 - || mInputHatches.size() < 1 - || (requiresOutputHatch() && mOutputHatches.size() < 1)) { + || mInputBusses.isEmpty() + || mInputHatches.isEmpty() + || (requiresOutputHatch() && mOutputHatches.isEmpty())) { log( "Bad Hatches - Turbine Housings: " + mTurbineRotorHatches.size() + ", Maint: " @@ -406,7 +406,7 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT for (MTEHatchInputBus aInputBus : this.mInputBusses) { for (int slot = aInputBus.getSizeInventory() - 1; slot >= 0; slot--) { ItemStack aStack = aInputBus.getStackInSlot(slot); - if (aStack != null && GTUtility.areStacksEqual(aStack, aTurbine)) { + if (GTUtility.areStacksEqual(aStack, aTurbine)) { aStack.stackSize -= aTurbine.stackSize; updateSlots(); endRecipeProcessing(); @@ -421,7 +421,7 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT public @NotNull CheckRecipeResult checkProcessing() { try { ArrayList<MTEHatchTurbine> aEmptyTurbineRotorHatches = getEmptyTurbineAssemblies(); - if (aEmptyTurbineRotorHatches.size() > 0) { + if (!aEmptyTurbineRotorHatches.isEmpty()) { hatch: for (MTEHatchTurbine aHatch : aEmptyTurbineRotorHatches) { ArrayList<ItemStack> aTurbines = getAllBufferedTurbines(); for (ItemStack aTurbineItem : aTurbines) { @@ -436,7 +436,7 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT } } - if (getEmptyTurbineAssemblies().size() > 0 || !areAllTurbinesTheSame()) { + if (!getEmptyTurbineAssemblies().isEmpty() || !areAllTurbinesTheSame()) { stopMachine(ShutDownReasonRegistry.NO_TURBINE); return CheckRecipeResultRegistry.NO_TURBINE_FOUND; } @@ -448,7 +448,7 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT TurbineStatCalculator turbine = new TurbineStatCalculator((MetaGeneratedTool) aStack.getItem(), aStack); - if (tFluids.size() > 0) { + if (!tFluids.isEmpty()) { if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity() @@ -606,7 +606,7 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT .toLowerCase() .contains("steam"); - String[] ret = new String[] { + return new String[] { // 8 Lines available for information panels tRunning + ": " + EnumChatFormatting.RED @@ -649,7 +649,6 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT + GTUtility.formatNumbers(mPollutionReduction) + EnumChatFormatting.RESET + " %" }; - return ret; } @Override @@ -794,7 +793,7 @@ public abstract class MTELargerTurbineBase extends GTPPMultiBlockBase<MTELargerT if (aEU <= 0) { return true; } - if (this.mAllDynamoHatches.size() > 0) { + if (!this.mAllDynamoHatches.isEmpty()) { return addEnergyOutputMultipleDynamos(aEU, true); } return false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbinePlasma.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbinePlasma.java index 3385125bb7..4f3626e7cd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbinePlasma.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/MTELargerTurbinePlasma.java @@ -23,7 +23,6 @@ import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.MTEHatchTurbine; -@SuppressWarnings("deprecation") public class MTELargerTurbinePlasma extends MTELargerTurbineBase { public MTELargerTurbinePlasma(int aID, String aName, String aNameRegional) { @@ -92,7 +91,7 @@ public class MTELargerTurbinePlasma extends MTELargerTurbineBase { try { ArrayList<MTEHatchTurbine> aEmptyTurbineRotorHatches = getEmptyTurbineAssemblies(); - if (aEmptyTurbineRotorHatches.size() > 0) { + if (!aEmptyTurbineRotorHatches.isEmpty()) { hatch: for (MTEHatchTurbine aHatch : aEmptyTurbineRotorHatches) { ArrayList<ItemStack> aTurbines = getAllBufferedTurbines(); for (ItemStack aTurbineItem : aTurbines) { @@ -107,7 +106,7 @@ public class MTELargerTurbinePlasma extends MTELargerTurbineBase { } } - if (getEmptyTurbineAssemblies().size() > 0 || !areAllTurbinesTheSame()) { + if (!getEmptyTurbineAssemblies().isEmpty() || !areAllTurbinesTheSame()) { stopMachine(ShutDownReasonRegistry.NO_TURBINE); return CheckRecipeResultRegistry.NO_TURBINE_FOUND; } @@ -122,7 +121,7 @@ public class MTELargerTurbinePlasma extends MTELargerTurbineBase { ArrayList<FluidStack> tFluids = getStoredFluids(); - if (tFluids.size() > 0) { + if (!tFluids.isEmpty()) { if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity() @@ -169,7 +168,7 @@ public class MTELargerTurbinePlasma extends MTELargerTurbineBase { // formula: // EU/t = EU/t * MIN(1, ( ( (FuelValue / 200) ^ 2 ) / EUPerTurbine)) int fuelValue = 0; - if (tFluids.size() > 0) { + if (!tFluids.isEmpty()) { fuelValue = getFuelValue(new FluidStack(tFluids.get(0), 0)); } float magicValue = (fuelValue * 0.005f) * (fuelValue * 0.005f); @@ -181,7 +180,7 @@ public class MTELargerTurbinePlasma extends MTELargerTurbineBase { // Magic numbers: can always change by at least 200 eu/s, but otherwise by at most 20 percent of the // difference in power level (per second) // This is how much the turbine can actually change during this tick - int maxChangeAllowed = Math.max(200, GTUtility.safeInt((long) Math.abs(difference) / 5)); + int maxChangeAllowed = Math.max(200, GTUtility.safeInt(Math.abs(difference) / 5)); if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed // change @@ -209,7 +208,7 @@ public class MTELargerTurbinePlasma extends MTELargerTurbineBase { } long fluidIntoPower(ArrayList<FluidStack> aFluids, TurbineStatCalculator turbine) { - if (aFluids.size() >= 1) { + if (!aFluids.isEmpty()) { int tEU = 0; int actualOptimalFlow = 0; @@ -255,18 +254,12 @@ public class MTELargerTurbinePlasma extends MTELargerTurbineBase { if (totalFlow <= 0) return 0; tEU = GTUtility.safeInt((long) ((fuelValue / 20D) * (double) totalFlow)); - if (totalFlow == actualOptimalFlow) { - tEU = GTUtility.safeInt( - (long) ((isLooseMode() ? turbine.getLoosePlasmaEfficiency() : turbine.getPlasmaEfficiency()) - * tEU)); - } else { + if (totalFlow != actualOptimalFlow) { double efficiency = 1.0D - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow); - tEU = (int) (tEU * efficiency); - tEU = GTUtility.safeInt( - (long) ((isLooseMode() ? turbine.getLoosePlasmaEfficiency() : turbine.getPlasmaEfficiency()) - * tEU)); } + tEU = GTUtility.safeInt( + (long) ((isLooseMode() ? turbine.getLoosePlasmaEfficiency() : turbine.getPlasmaEfficiency()) * tEU)); return tEU; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java index f392bff171..241b970ae8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java @@ -81,7 +81,7 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GTPPMult public class GregtechMetaTileEntity_PowerSubStationController extends GTPPMultiBlockBase<GregtechMetaTileEntity_PowerSubStationController> implements ISurvivalConstructable { - private static enum TopState { + private enum TopState { MayBeTop, Top, NotTop @@ -99,7 +99,7 @@ public class GregtechMetaTileEntity_PowerSubStationController private final int ENERGY_TAX = 5; private int mCasing; - private int[] cellCount = new int[6]; + private final int[] cellCount = new int[6]; private TopState topState = TopState.MayBeTop; private static IStructureDefinition<GregtechMetaTileEntity_PowerSubStationController> STRUCTURE_DEFINITION = null; @@ -212,17 +212,13 @@ public class GregtechMetaTileEntity_PowerSubStationController } public static int getMaxHatchTier(int aCellTier) { - switch (aCellTier) { - case 9 -> { - return GTValues.VOLTAGE_NAMES[9].equals("Ultimate High Voltage") ? 15 : 9; - } - default -> { - if (aCellTier < 4) { - return 0; - } else { - return aCellTier; - } - } + if (aCellTier == 9) { + return GTValues.VOLTAGE_NAMES[9].equals("Ultimate High Voltage") ? 15 : 9; + } + if (aCellTier < 4) { + return 0; + } else { + return aCellTier; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/MTESolarHeater.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/MTESolarHeater.java index 64925c9bb1..45721139bb 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/MTESolarHeater.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/MTESolarHeater.java @@ -266,7 +266,7 @@ public class MTESolarHeater extends MTETieredMachineBlock { } public boolean canSeeSky() { - if (this.getBaseMetaTileEntity() + return this.getBaseMetaTileEntity() .getWorld() .canBlockSeeTheSky( this.getBaseMetaTileEntity() @@ -274,17 +274,14 @@ public class MTESolarHeater extends MTETieredMachineBlock { this.getBaseMetaTileEntity() .getYCoord() + 1, this.getBaseMetaTileEntity() - .getZCoord())) { - return true; - } - return false; + .getZCoord()); } public boolean setSolarTower(MTESolarTower aTowerTile) { if (!hasSolarTower()) { this.mTX = aTowerTile.getBaseMetaTileEntity() .getXCoord(); - this.mTY = (int) aTowerTile.getBaseMetaTileEntity() + this.mTY = aTowerTile.getBaseMetaTileEntity() .getYCoord(); this.mTZ = aTowerTile.getBaseMetaTileEntity() .getZCoord(); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/MTERedstoneCircuitBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/MTERedstoneCircuitBlock.java index 20cd569e24..fceebe62d3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/MTERedstoneCircuitBlock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/MTERedstoneCircuitBlock.java @@ -46,7 +46,8 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; public class MTERedstoneCircuitBlock extends MTERedstoneBase implements IRedstoneCircuitBlock, IAddUIWidgets { - public int mGate = 0, mGateData[] = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }; + public int mGate = 0; + public int[] mGateData = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }; public boolean bOutput = true; public MTERedstoneCircuitBlock(int aID) { @@ -159,8 +160,7 @@ public class MTERedstoneCircuitBlock extends MTERedstoneBase implements IRedston public void switchGateForward(boolean aShift) { try { Set<Integer> tKeys = GregTechAPI.sCircuitryBehaviors.keySet(); - ArrayList<Integer> tList = new ArrayList<>(); - tList.addAll(tKeys); + ArrayList<Integer> tList = new ArrayList<>(tKeys); if (tList.size() <= 0) return; Collections.sort(tList); if (!GregTechAPI.sCircuitryBehaviors.containsKey(mGate)) mGate = tList.get(0); @@ -177,8 +177,7 @@ public class MTERedstoneCircuitBlock extends MTERedstoneBase implements IRedston public void switchGateBackward(boolean aShift) { try { Set<Integer> tKeys = GregTechAPI.sCircuitryBehaviors.keySet(); - ArrayList<Integer> tList = new ArrayList<>(); - tList.addAll(tKeys); + ArrayList<Integer> tList = new ArrayList<>(tKeys); if (tList.size() <= 0) return; Collections.sort(tList); if (!GregTechAPI.sCircuitryBehaviors.containsKey(mGate)) mGate = tList.get(0); @@ -324,7 +323,7 @@ public class MTERedstoneCircuitBlock extends MTERedstoneBase implements IRedston if (sCoversItems.isEmpty()) { initCovers(); } - return sCoversItems.get(Integer.valueOf(aStack)); + return sCoversItems.get(aStack); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/MTETieredChest.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/MTETieredChest.java index 423a71c3e1..51e5431da0 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/MTETieredChest.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/MTETieredChest.java @@ -39,8 +39,7 @@ public class MTETieredChest extends MTETieredMachineBlock implements IAddUIWidge aNameRegional, aTier, 3, - "This Chest stores " + (int) (Math.pow(6.0D, (double) aTier) * mStorageFactor) + " Items", - new ITexture[0]); + "This Chest stores " + (int) (Math.pow(6.0D, aTier) * mStorageFactor) + " Items"); } public MTETieredChest(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { @@ -151,7 +150,7 @@ public class MTETieredChest extends MTETieredMachineBlock implements IAddUIWidge @Override public int getMaxItemCount() { - return (int) (Math.pow(6.0D, (double) this.mTier) * mStorageFactor - 128.0D); + return (int) (Math.pow(6.0D, this.mTier) * mStorageFactor - 128.0D); } public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, |