diff options
Diffstat (limited to 'src/main/java/gregtech/common/tileentities')
37 files changed, 96 insertions, 129 deletions
diff --git a/src/main/java/gregtech/common/tileentities/casings/upgrade/Inventory.java b/src/main/java/gregtech/common/tileentities/casings/upgrade/Inventory.java index 43cc20f983..26f26604bf 100644 --- a/src/main/java/gregtech/common/tileentities/casings/upgrade/Inventory.java +++ b/src/main/java/gregtech/common/tileentities/casings/upgrade/Inventory.java @@ -22,7 +22,7 @@ public class Inventory extends UpgradeCasing { private String inventoryName = "inventory"; private int inventorySize; - private InventoryType type = InventoryType.Both; + private final InventoryType type = InventoryType.Both; public String getCustomInventoryName() { return inventoryName; diff --git a/src/main/java/gregtech/common/tileentities/casings/upgrade/Tank.java b/src/main/java/gregtech/common/tileentities/casings/upgrade/Tank.java index a7ace14de5..b373d79ab5 100644 --- a/src/main/java/gregtech/common/tileentities/casings/upgrade/Tank.java +++ b/src/main/java/gregtech/common/tileentities/casings/upgrade/Tank.java @@ -19,8 +19,8 @@ public class Tank extends UpgradeCasing { public static final int INPUT = 0; public static final int OUTPUT = 1; public static final int BOTH = 2; - private String tankName = "tank"; - private int type = BOTH; + private final String tankName = "tank"; + private final int type = BOTH; @Override protected void customWork(IMultiBlockController aTarget) { diff --git a/src/main/java/gregtech/common/tileentities/generators/MTEMagicalEnergyAbsorber.java b/src/main/java/gregtech/common/tileentities/generators/MTEMagicalEnergyAbsorber.java index 01d2e1ee07..242d8eaaea 100644 --- a/src/main/java/gregtech/common/tileentities/generators/MTEMagicalEnergyAbsorber.java +++ b/src/main/java/gregtech/common/tileentities/generators/MTEMagicalEnergyAbsorber.java @@ -85,11 +85,11 @@ public class MTEMagicalEnergyAbsorber extends MTEBasicGenerator implements Magic private static final Map<Aspect, Integer> sAspectsEnergy = new HashMap<>(); private static boolean sAllowMultipleEggs = false; private static MTEMagicalEnergyAbsorber sActiveSiphon = null; - private static int sEnergyPerEndercrystal = 512; - private static int sEnergyFromVis = 20; - private static int sEnergyPerEssentia = 320; - private static int sDragonEggEnergyPerTick = 2048; - private static int sCreeperEggEnergyPerTick = 512; + private static final int sEnergyPerEndercrystal = 512; + private static final int sEnergyFromVis = 20; + private static final int sEnergyPerEssentia = 320; + private static final int sDragonEggEnergyPerTick = 2048; + private static final int sCreeperEggEnergyPerTick = 512; private final MagicalEnergyBB mMagicalEnergyBB = new MagicalEnergyBB(this, mTier, mTier + 2); private int mEfficiency; private int mMaxVisPerDrain; diff --git a/src/main/java/gregtech/common/tileentities/generators/MTENaquadahReactor.java b/src/main/java/gregtech/common/tileentities/generators/MTENaquadahReactor.java index 276fdff07c..0bbe3bb7e7 100644 --- a/src/main/java/gregtech/common/tileentities/generators/MTENaquadahReactor.java +++ b/src/main/java/gregtech/common/tileentities/generators/MTENaquadahReactor.java @@ -33,7 +33,7 @@ import gregtech.api.render.TextureFactory; public class MTENaquadahReactor extends MTEBasicGenerator { - private int mEfficiency; + private final int mEfficiency; public MTENaquadahReactor(int aID, String aName, String[] aDescription, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, aDescription); diff --git a/src/main/java/gregtech/common/tileentities/generators/MTESteamTurbine.java b/src/main/java/gregtech/common/tileentities/generators/MTESteamTurbine.java index bb6138d35a..6564ecfe8f 100644 --- a/src/main/java/gregtech/common/tileentities/generators/MTESteamTurbine.java +++ b/src/main/java/gregtech/common/tileentities/generators/MTESteamTurbine.java @@ -230,7 +230,6 @@ public class MTESteamTurbine extends MTEBasicGenerator { public boolean isFluidInputAllowed(FluidStack aFluid) { if (GTModHandler.isSuperHeatedSteam(aFluid)) { aFluid.amount = 0; - aFluid = null; return false; } return super.isFluidInputAllowed(aFluid); diff --git a/src/main/java/gregtech/common/tileentities/machines/IDualInputHatch.java b/src/main/java/gregtech/common/tileentities/machines/IDualInputHatch.java index c89aaaff40..0660f6b1a1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/IDualInputHatch.java +++ b/src/main/java/gregtech/common/tileentities/machines/IDualInputHatch.java @@ -17,5 +17,5 @@ public interface IDualInputHatch { Optional<IDualInputInventory> getFirstNonEmptyInventory(); - public boolean supportsFluids(); + boolean supportsFluids(); } diff --git a/src/main/java/gregtech/common/tileentities/machines/ISmartInputHatch.java b/src/main/java/gregtech/common/tileentities/machines/ISmartInputHatch.java index dc5cac45f8..bbf6c5b631 100644 --- a/src/main/java/gregtech/common/tileentities/machines/ISmartInputHatch.java +++ b/src/main/java/gregtech/common/tileentities/machines/ISmartInputHatch.java @@ -10,6 +10,6 @@ public interface ISmartInputHatch { // Have the contents of the hatch changed since the last check? boolean justUpdated(); - public boolean doFastRecipeCheck(); + boolean doFastRecipeCheck(); } diff --git a/src/main/java/gregtech/common/tileentities/machines/MTEHatchCraftingInputME.java b/src/main/java/gregtech/common/tileentities/machines/MTEHatchCraftingInputME.java index b6adf65440..d1bc27310a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/MTEHatchCraftingInputME.java +++ b/src/main/java/gregtech/common/tileentities/machines/MTEHatchCraftingInputME.java @@ -323,16 +323,17 @@ public class MTEHatchCraftingInputME extends MTEHatchInputBus private @Nullable AENetworkProxy gridProxy = null; // holds all internal inventories - private PatternSlot[] internalInventory = new PatternSlot[MAX_PATTERN_COUNT]; + private final PatternSlot[] internalInventory = new PatternSlot[MAX_PATTERN_COUNT]; // a hash map for faster lookup of pattern slots, not necessarily all valid. - private Map<ICraftingPatternDetails, PatternSlot> patternDetailsPatternSlotMap = new HashMap<>(MAX_PATTERN_COUNT); + private final Map<ICraftingPatternDetails, PatternSlot> patternDetailsPatternSlotMap = new HashMap<>( + MAX_PATTERN_COUNT); private boolean needPatternSync = true; private boolean justHadNewItems = false; private String customName = null; - private boolean supportFluids; + private final boolean supportFluids; private boolean additionalConnection = false; private boolean disablePatternOptimization = false; @@ -571,15 +572,14 @@ public class MTEHatchCraftingInputME extends MTEHatchInputBus // Migrate from 4x8 to 4x9 pattern inventory int oldPatternCount = 4 * 8; int oldSlotManual = oldPatternCount + 1; - int oldSlotCircuit = oldPatternCount; if (internalInventory[oldSlotManual] == null && mInventory[oldSlotManual] != null) { mInventory[SLOT_MANUAL_START] = mInventory[oldSlotManual]; mInventory[oldSlotManual] = null; } - if (internalInventory[oldSlotCircuit] == null && mInventory[oldSlotCircuit] != null) { - mInventory[SLOT_CIRCUIT] = mInventory[oldSlotCircuit]; - mInventory[oldSlotCircuit] = null; + if (internalInventory[oldPatternCount] == null && mInventory[oldPatternCount] != null) { + mInventory[SLOT_CIRCUIT] = mInventory[oldPatternCount]; + mInventory[oldPatternCount] = null; } // reconstruct patternDetailsPatternSlotMap diff --git a/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputBusME.java b/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputBusME.java index 969d9c6c05..9e396b8b27 100644 --- a/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputBusME.java +++ b/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputBusME.java @@ -125,10 +125,7 @@ public class MTEHatchOutputBusME extends MTEHatchOutputBus implements IPowerChan * Check if the internal cache can still fit more items in it */ public boolean canAcceptItem() { - if (getCachedAmount() < getCacheCapacity()) { - return true; - } - return false; + return getCachedAmount() < getCacheCapacity(); } /** diff --git a/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputME.java b/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputME.java index 5983a2d32a..7ebe9929c3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputME.java +++ b/src/main/java/gregtech/common/tileentities/machines/MTEHatchOutputME.java @@ -147,10 +147,7 @@ public class MTEHatchOutputME extends MTEHatchOutput implements IPowerChannelSta * Check if the internal cache can still fit more fluids in it */ public boolean canAcceptFluid() { - if (getCachedAmount() < getCacheCapacity()) { - return true; - } - return false; + return getCachedAmount() < getCacheCapacity(); } /** diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/MTEPump.java b/src/main/java/gregtech/common/tileentities/machines/basic/MTEPump.java index a6a99a58fa..b8d9803951 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/MTEPump.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/MTEPump.java @@ -500,7 +500,7 @@ public class MTEPump extends MTEBasicMachine { for (int i = 0; i < mInputSlotCount; i++) { ItemStack stack = getInputAt(i); - if (stack != null && GTUtility.areStacksEqual(stack, MINING_PIPE) && stack.stackSize > 0) { + if (GTUtility.areStacksEqual(stack, MINING_PIPE) && stack.stackSize > 0) { foundPipe = true; break; } @@ -562,7 +562,7 @@ public class MTEPump extends MTEBasicMachine { for (int i = 0; i < mInputSlotCount; i++) { ItemStack stack = getInputAt(i); - if (stack != null && GTUtility.areStacksEqual(stack, MINING_PIPE) && stack.stackSize > 0) { + if (GTUtility.areStacksEqual(stack, MINING_PIPE) && stack.stackSize > 0) { foundPipe = true; stack.stackSize -= 1; if (stack.stackSize == 0) { diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/MTETurboCharger.java b/src/main/java/gregtech/common/tileentities/machines/basic/MTETurboCharger.java index 3e1ebd298e..c377600528 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/MTETurboCharger.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/MTETurboCharger.java @@ -87,10 +87,8 @@ public class MTETurboCharger extends MTECharger { } } - if (getBaseMetaTileEntity() instanceof BaseMetaTileEntity) { - BaseMetaTileEntity mBaseMetaTileEntity = (BaseMetaTileEntity) getBaseMetaTileEntity(); - if (mBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity) { - MetaTileEntity mMetaTileEntity = (MetaTileEntity) mBaseMetaTileEntity.getMetaTileEntity(); + if (getBaseMetaTileEntity() instanceof BaseMetaTileEntity mBaseMetaTileEntity) { + if (mBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity mMetaTileEntity) { if (mMetaTileEntity.dechargerSlotCount() > 0 && mBaseMetaTileEntity.getStoredEU() < mBaseMetaTileEntity.getEUCapacity()) { for (int i = mMetaTileEntity.dechargerSlotStartIndex(), diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/MTEWorldAccelerator.java b/src/main/java/gregtech/common/tileentities/machines/basic/MTEWorldAccelerator.java index bb086dc654..5046ecd8b1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/MTEWorldAccelerator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/MTEWorldAccelerator.java @@ -33,7 +33,7 @@ public class MTEWorldAccelerator extends MTETieredMachineBlock { // simple name is rather expensive to compute and it's not cached // see https://stackoverflow.com/q/17369304 - private static final ClassValue<String> simpleNameCache = new ClassValue<String>() { + private static final ClassValue<String> simpleNameCache = new ClassValue<>() { @Override protected String computeValue(Class<?> type) { @@ -87,7 +87,8 @@ public class MTEWorldAccelerator extends MTETieredMachineBlock { private static Textures.BlockIcons.CustomIcon _mGTIco_Norm_Active; private static Textures.BlockIcons.CustomIcon _mGTIco_TE_Idle; private static Textures.BlockIcons.CustomIcon _mGTIco_TE_Active; - private static int[] mAccelerateStatic = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 512, 512, 512, 512, 512, 512 }; + private static final int[] mAccelerateStatic = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 512, 512, 512, 512, 512, + 512 }; private static final int AMPERAGE_NORMAL = 3; private static final int AMPERAGE_TE = 6; @@ -272,7 +273,7 @@ public class MTEWorldAccelerator extends MTETieredMachineBlock { return 8; } - private static String[] mModeStr = { "Blocks", "TileEntities" }; + private static final String[] mModeStr = { "Blocks", "TileEntities" }; // This uses the Wrench as second tool to cycle speeds @Override @@ -297,8 +298,7 @@ public class MTEWorldAccelerator extends MTETieredMachineBlock { markDirty(); PlayerChatHelper .SendInfo(pPlayer, String.format("Machine radius changed to %d Blocks", getRadiusTierOverride())); - } else PlayerChatHelper - .SendError(pPlayer, String.format("Can't change radius; Machine is in TileEntity Mode!")); + } else PlayerChatHelper.SendError(pPlayer, "Can't change radius; Machine is in TileEntity Mode!"); } else { mMode = (byte) (mMode == 0x00 ? 0x01 : 0x00); markDirty(); diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineBase.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineBase.java index 6f6f01f3ba..259988c16a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineBase.java @@ -1,19 +1,19 @@ /** * * Inspired/ported from GregTech 6 under the LGPL license - * + * <p> * Copyright (c) 2020 GregTech-6 Team - * + * <p> * This file is part of GregTech. - * + * <p> * GregTech is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later * version. - * + * <p> * GregTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. - * + * <p> * You should have received a copy of the GNU Lesser General Public License along with GregTech. If not, see * <http://www.gnu.org/licenses/>. */ diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineFluid.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineFluid.java index e3886360c6..7cac54c4c6 100644 --- a/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineFluid.java +++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineFluid.java @@ -1,19 +1,19 @@ /** * * Inspired/ported from GregTech 6 under the LGPL license - * + * <p> * Copyright (c) 2020 GregTech-6 Team - * + * <p> * This file is part of GregTech. - * + * <p> * GregTech is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later * version. - * + * <p> * GregTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. - * + * <p> * You should have received a copy of the GNU Lesser General Public License along with GregTech. If not, see * <http://www.gnu.org/licenses/>. */ diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineItem.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineItem.java index f619d40329..e6d1ee0612 100644 --- a/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineItem.java +++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/MTELongDistancePipelineItem.java @@ -1,19 +1,19 @@ /** * * Inspired/ported from GregTech 6 under the LGPL license - * + * <p> * Copyright (c) 2020 GregTech-6 Team - * + * <p> * This file is part of GregTech. - * + * <p> * GregTech is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later * version. - * + * <p> * GregTech is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. - * + * <p> * You should have received a copy of the GNU Lesser General Public License along with GregTech. If not, see * <http://www.gnu.org/licenses/>. */ diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java index 20b3ce4b32..43c383a102 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java @@ -270,8 +270,8 @@ public class MTEIndustrialElectromagneticSeparator if (!mExoticEnergyHatches.isEmpty()) { if (!mEnergyHatches.isEmpty()) return false; if (mExoticEnergyHatches.size() > 1) return false; - if (mExoticEnergyHatches.get(0) - .maxWorkingAmperesIn() > 64) return false; + return mExoticEnergyHatches.get(0) + .maxWorkingAmperesIn() <= 64; } // All checks passed! diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java index 79af9a2e6b..8efb36a5ed 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialLaserEngraver.java @@ -310,9 +310,7 @@ public class MTEIndustrialLaserEngraver extends MTEExtendedPowerMultiBlockBase<M if (mCasingAmount < 35) return false; if (laserSource == null) return false; if (!findLaserRenderer(base.getWorld(), base.getXCoord(), base.getYCoord(), base.getZCoord())) return false; - if (glassTier < VoltageIndex.UMV && laserSource.mTier > glassTier) return false; - - return true; + return glassTier >= VoltageIndex.UMV || laserSource.mTier <= glassTier; } private static String getUniqueIdentifier(ItemStack is) { @@ -594,7 +592,6 @@ public class MTEIndustrialLaserEngraver extends MTEExtendedPowerMultiBlockBase<M lensColors.put("gt.bwMetaGeneratedlens11499", Colors.Green); lensColors.put("gt.bwMetaGeneratedlens11358", Colors.Red); lensColors.put("MU-metaitem.0132140", Colors.Purple); - lensColors.put("MU-metaitem.0132140", Colors.Purple); // } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java index fe7994f8a1..16a89bcb93 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java @@ -176,6 +176,7 @@ public class MTELargeFluidExtractor extends MTEExtendedPowerMultiBlockBase<MTELa if (mGlassTier < 10 && energyHatch.getTierForStructure() > mGlassTier) { mStructureBadGlassTier = true; + break; } } @@ -203,10 +204,9 @@ public class MTELargeFluidExtractor extends MTEExtendedPowerMultiBlockBase<MTELa logic.setAmperageOC(true); logic.setAvailableVoltage(this.getMaxInputEu()); logic.setAvailableAmperage(1); - - logic.setEuModifier((float) (getEUMultiplier())); + logic.setEuModifier(getEUMultiplier()); logic.setMaxParallel(getParallels()); - logic.setSpeedBonus(1.0f / (float) (getSpeedBonus())); + logic.setSpeedBonus(1.0f / getSpeedBonus()); } @Override @@ -390,16 +390,15 @@ public class MTELargeFluidExtractor extends MTEExtendedPowerMultiBlockBase<MTELa @Override public String[] getInfoData() { - var data = new ArrayList<String>(); - data.addAll(Arrays.asList(super.getInfoData())); + ArrayList<String> data = new ArrayList<>(Arrays.asList(super.getInfoData())); data.add(String.format("Max Parallels: %s%d%s", YELLOW, getParallels(), RESET)); data.add(String.format("Heating Coil Speed Bonus: +%s%.0f%s %%", YELLOW, getCoilSpeedBonus() * 100, RESET)); data.add(String.format("Total Speed Multiplier: %s%.0f%s %%", YELLOW, getSpeedBonus() * 100, RESET)); data.add(String.format("Total EU/t Multiplier: %s%.0f%s %%", YELLOW, getEUMultiplier() * 100, RESET)); - return data.toArray(new String[data.size()]); + return data.toArray(new String[0]); } public int getParallels() { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java index a411621eaa..de35a7d3bc 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTurbine.java @@ -396,7 +396,7 @@ public abstract class MTELargeTurbine extends MTEEnhancedMultiBlockBase<MTELarge maxEnergy += tHatch.getBaseMetaTileEntity() .getEUCapacity(); } - String[] ret = new String[] { + return new String[] { // 8 Lines available for information panels tRunning + ": " + EnumChatFormatting.RED @@ -441,7 +441,6 @@ public abstract class MTELargeTurbine extends MTEEnhancedMultiBlockBase<MTELarge + EnumChatFormatting.RESET + " %" /* 8 */ }; - return ret; } public boolean hasTurbine() { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeTur |
