diff options
| author | Alexdoru <57050655+Alexdoru@users.noreply.github.com> | 2024-10-02 07:31:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-02 05:31:08 +0000 |
| commit | 3b9bd1188e932e6bb8041f7bb9afbf3ce75e26d3 (patch) | |
| tree | 107d9d2442891990ef1cdef1d8bb2df6bb96952a /src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities | |
| parent | bfc7b2b07f72d0903a70791ff96f9c837ddd5ff0 (diff) | |
| download | GT5-Unofficial-3b9bd1188e932e6bb8041f7bb9afbf3ce75e26d3.tar.gz GT5-Unofficial-3b9bd1188e932e6bb8041f7bb9afbf3ce75e26d3.tar.bz2 GT5-Unofficial-3b9bd1188e932e6bb8041f7bb9afbf3ce75e26d3.zip | |
Cleanup the codebase (#3311)
Co-authored-by: boubou19 <miisterunknown@gmail.com>
Diffstat (limited to 'src/main/java/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/ |
