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 | |
| 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')
49 files changed, 224 insertions, 326 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksPipeGearbox.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksPipeGearbox.java index 32f1f127d0..087e4fb056 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksPipeGearbox.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksPipeGearbox.java @@ -15,7 +15,7 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; public class GregtechMetaCasingBlocksPipeGearbox extends GregtechMetaCasingBlocksAbstract { - private static HashMap<Integer, Integer> sMaterialMapping = new HashMap<>(); + private static final HashMap<Integer, Integer> sMaterialMapping = new HashMap<>(); public GregtechMetaCasingBlocksPipeGearbox() { super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.pipesgears", MaterialCasings.INSTANCE); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java index 128e9c95d7..8208147236 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java @@ -13,43 +13,43 @@ import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.MT public class TexturesGrinderMultiblock { - private static CustomIcon GT8_1_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE1"); - private static CustomIcon GT8_1 = new CustomIcon("iconsets/Grinder/GRINDER1"); - private static CustomIcon GT8_2_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE2"); - private static CustomIcon GT8_2 = new CustomIcon("iconsets/Grinder/GRINDER2"); - private static CustomIcon GT8_3_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE3"); - private static CustomIcon GT8_3 = new CustomIcon("iconsets/Grinder/GRINDER3"); - private static CustomIcon GT8_4_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE4"); - private static CustomIcon GT8_4 = new CustomIcon("iconsets/Grinder/GRINDER4"); - private static CustomIcon GT8_5_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE5"); - private static CustomIcon GT8_5 = new CustomIcon("iconsets/Grinder/GRINDER5"); - private static CustomIcon GT8_6_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE6"); - private static CustomIcon GT8_6 = new CustomIcon("iconsets/Grinder/GRINDER6"); - private static CustomIcon GT8_7_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE7"); - private static CustomIcon GT8_7 = new CustomIcon("iconsets/Grinder/GRINDER7"); - private static CustomIcon GT8_8_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE8"); - private static CustomIcon GT8_8 = new CustomIcon("iconsets/Grinder/GRINDER8"); - private static CustomIcon GT8_9_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE9"); - private static CustomIcon GT8_9 = new CustomIcon("iconsets/Grinder/GRINDER9"); + private static final CustomIcon GT8_1_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE1"); + private static final CustomIcon GT8_1 = new CustomIcon("iconsets/Grinder/GRINDER1"); + private static final CustomIcon GT8_2_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE2"); + private static final CustomIcon GT8_2 = new CustomIcon("iconsets/Grinder/GRINDER2"); + private static final CustomIcon GT8_3_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE3"); + private static final CustomIcon GT8_3 = new CustomIcon("iconsets/Grinder/GRINDER3"); + private static final CustomIcon GT8_4_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE4"); + private static final CustomIcon GT8_4 = new CustomIcon("iconsets/Grinder/GRINDER4"); + private static final CustomIcon GT8_5_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE5"); + private static final CustomIcon GT8_5 = new CustomIcon("iconsets/Grinder/GRINDER5"); + private static final CustomIcon GT8_6_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE6"); + private static final CustomIcon GT8_6 = new CustomIcon("iconsets/Grinder/GRINDER6"); + private static final CustomIcon GT8_7_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE7"); + private static final CustomIcon GT8_7 = new CustomIcon("iconsets/Grinder/GRINDER7"); + private static final CustomIcon GT8_8_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE8"); + private static final CustomIcon GT8_8 = new CustomIcon("iconsets/Grinder/GRINDER8"); + private static final CustomIcon GT8_9_Active = new CustomIcon("iconsets/Grinder/GRINDER_ACTIVE9"); + private static final CustomIcon GT8_9 = new CustomIcon("iconsets/Grinder/GRINDER9"); - private static CustomIcon frontFace_0 = (GT8_1); - private static CustomIcon frontFaceActive_0 = (GT8_1_Active); - private static CustomIcon frontFace_1 = (GT8_2); - private static CustomIcon frontFaceActive_1 = (GT8_2_Active); - private static CustomIcon frontFace_2 = (GT8_3); - private static CustomIcon frontFaceActive_2 = (GT8_3_Active); - private static CustomIcon frontFace_3 = (GT8_4); - private static CustomIcon frontFaceActive_3 = (GT8_4_Active); - private static CustomIcon frontFace_4 = (GT8_5); - private static CustomIcon frontFaceActive_4 = (GT8_5_Active); - private static CustomIcon frontFace_5 = (GT8_6); - private static CustomIcon frontFaceActive_5 = (GT8_6_Active); - private static CustomIcon frontFace_6 = (GT8_7); - private static CustomIcon frontFaceActive_6 = (GT8_7_Active); - private static CustomIcon frontFace_7 = (GT8_8); - private static CustomIcon frontFaceActive_7 = (GT8_8_Active); - private static CustomIcon frontFace_8 = (GT8_9); - private static CustomIcon frontFaceActive_8 = (GT8_9_Active); + private static final CustomIcon frontFace_0 = (GT8_1); + private static final CustomIcon frontFaceActive_0 = (GT8_1_Active); + private static final CustomIcon frontFace_1 = (GT8_2); + private static final CustomIcon frontFaceActive_1 = (GT8_2_Active); + private static final CustomIcon frontFace_2 = (GT8_3); + private static final CustomIcon frontFaceActive_2 = (GT8_3_Active); + private static final CustomIcon frontFace_3 = (GT8_4); + private static final CustomIcon frontFaceActive_3 = (GT8_4_Active); + private static final CustomIcon frontFace_4 = (GT8_5); + private static final CustomIcon frontFaceActive_4 = (GT8_5_Active); + private static final CustomIcon frontFace_5 = (GT8_6); + private static final CustomIcon frontFaceActive_5 = (GT8_6_Active); + private static final CustomIcon frontFace_6 = (GT8_7); + private static final CustomIcon frontFaceActive_6 = (GT8_7_Active); + private static final CustomIcon frontFace_7 = (GT8_8); + private static final CustomIcon frontFaceActive_7 = (GT8_8_Active); + private static final CustomIcon frontFace_8 = (GT8_9); + private static final CustomIcon frontFaceActive_8 = (GT8_9_Active); CustomIcon[] GRINDER = new CustomIcon[] { frontFace_0, frontFace_1, frontFace_2, frontFace_3, frontFace_4, frontFace_5, frontFace_6, frontFace_7, frontFace_8 }; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java index dea287fde6..e0acc6666d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java @@ -383,16 +383,12 @@ public class LargeTurbineTextureHandler { public static boolean isUsingAnimatedTexture(TileEntity tTileEntity) { boolean aVal = true; - IGregTechTileEntity aTile; - if (tTileEntity instanceof IGregTechTileEntity) { - aTile = (IGregTechTileEntity) tTileEntity; - if (aTile != null) { - final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity(); - if (aMetaTileEntity != null && aMetaTileEntity instanceof MTEHatchTurbine) { - aVal = ((MTEHatchTurbine) aMetaTileEntity).getBaseMetaTileEntity() - .isActive(); - // Logger.INFO("Returning "+aVal+" as Rotor Assembly controller status"); - } + if (tTileEntity instanceof IGregTechTileEntity aTile) { + final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity(); + if (aMetaTileEntity instanceof MTEHatchTurbine) { + aVal = aMetaTileEntity.getBaseMetaTileEntity() + .isActive(); + // Logger.INFO("Returning "+aVal+" as Rotor Assembly controller status"); } } return aVal; @@ -401,7 +397,7 @@ public class LargeTurbineTextureHandler { public static MTEHatchTurbine isTurbineHatch(final IGregTechTileEntity aTileEntity) { if (aTileEntity != null) { final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity != null && aMetaTileEntity instanceof MTEHatchTurbine) { + if (aMetaTileEntity instanceof MTEHatchTurbine) { return (MTEHatchTurbine) aMetaTileEntity; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverToggleVisual.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverToggleVisual.java index 2ba532d11f..891035f7ac 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverToggleVisual.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/CoverToggleVisual.java @@ -31,8 +31,7 @@ public class CoverToggleVisual extends CoverBehavior { BlockPos aPos = new BlockPos( aEntity.getIGregTechTileEntity(aEntity.getXCoord(), aEntity.getYCoord(), aEntity.getZCoord())); - String s = aEntity.getInventoryName() + "." + aPos.getUniqueIdentifier() + side.name(); - return s; + return aEntity.getInventoryName() + "." + aPos.getUniqueIdentifier() + side.name(); } catch (Throwable t) {} XSTR x = new XSTR(); return "ERROR." + x.getSeed() + x.hashCode() + x.nextDouble() + ".ID"; @@ -168,10 +167,10 @@ public class CoverToggleVisual extends CoverBehavior { public static boolean getConnectionState(String aKey) { Integer b = sConnectionStateForEntityMap.get(aKey); // Logger.INFO("Get State: "+b+" | "+aKey); - return b != null ? b == VALUE_ON : false; + return b != null && b == VALUE_ON; } - public static final boolean getCoverConnections(final ItemStack aStack) { + public static boolean getCoverConnections(final ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("CustomCoverMeta"); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java index 773bf0127e..4ef2838542 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java @@ -46,7 +46,7 @@ public class FlotationRecipeHandler { } public static ItemStack findMilledStack(ItemStack[] aInputs) { - if (aInputs == null || aInputs.length <= 0) { + if (aInputs == null) { return null; } for (ItemStack aStack : aInputs) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java index 03a4ace32f..35de0d8cea 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/tesseract/TesseractHelper.java @@ -25,7 +25,7 @@ public class TesseractHelper { */ // Checks if a Generator is owned by a player. - public static final boolean isGeneratorOwnedByPlayer(EntityPlayer player, MTETesseractGenerator generator) { + public static boolean isGeneratorOwnedByPlayer(EntityPlayer player, MTETesseractGenerator generator) { if (player == null) { Logger.WARNING("Failed. [isGeneratorOwnedByPlayer]"); return false; @@ -50,7 +50,7 @@ public class TesseractHelper { } // Saves A Generator to the Players UUID map along with the Freq. - public static final boolean setGeneratorOwnershipByPlayer(EntityPlayer player, int freq, + public static boolean setGeneratorOwnershipByPlayer(EntityPlayer player, int freq, MTETesseractGenerator generator) { if (player == null) { return false; @@ -82,7 +82,7 @@ public class TesseractHelper { } // Gets Generator based on Frequency. - public static final MTETesseractGenerator getGeneratorByFrequency(EntityPlayer player, int freq) { + public static MTETesseractGenerator getGeneratorByFrequency(EntityPlayer player, int freq) { if (player == null) { return null; } @@ -107,7 +107,7 @@ public class TesseractHelper { } // Remove Tesseract Generator - public static final boolean removeGenerator(EntityPlayer player, int frequency) { + public static boolean removeGenerator(EntityPlayer player, int frequency) { if (player == null) { return false; } @@ -129,7 +129,7 @@ public class TesseractHelper { */ // Checks if a Terminal is owned by a player. - public static final boolean isTerminalOwnedByPlayer(EntityPlayer player, MTETesseractTerminal generator) { + public static boolean isTerminalOwnedByPlayer(EntityPlayer player, MTETesseractTerminal generator) { if (player == null) { return false; } @@ -148,8 +148,7 @@ public class TesseractHelper { } // Saves A Terminal to the Players UUID map along with the Freq. - public static final boolean setTerminalOwnershipByPlayer(EntityPlayer player, int freq, - MTETesseractTerminal generator) { + public static boolean setTerminalOwnershipByPlayer(EntityPlayer player, int freq, MTETesseractTerminal generator) { if (player == null) { return false; } @@ -178,7 +177,7 @@ public class TesseractHelper { } // Gets Terminal based on Frequency. - public static final MTETesseractTerminal getTerminalByFrequency(EntityPlayer player, int freq) { + public static MTETesseractTerminal getTerminalByFrequency(EntityPlayer player, int freq) { if (player == null) { return null; } @@ -200,7 +199,7 @@ public class TesseractHelper { } // Remove Tesseract Terminal - public static final boolean removeTerminal(EntityPlayer player, int frequency) { + public static boolean removeTerminal(EntityPlayer player, int frequency) { if (player == null) { return false; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java index a6cd63ca19..76b0ca91ea 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java @@ -18,7 +18,6 @@ import org.apache.commons.lang3.StringUtils; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTechAPI; import gregtech.api.interfaces.IIconContainer; -import gregtech.api.interfaces.ITexture; import gregtech.api.objects.GTMultiTexture; import gregtech.api.objects.GTRenderedTexture; import gtPlusPlus.api.objects.Logger; @@ -74,7 +73,7 @@ public class MetaCustomCoverItem extends Item { } GregTechAPI.registerCover( thisStack, - new GTMultiTexture(new ITexture[] { new GTRenderedTexture(mTextures[i]) }), + new GTMultiTexture(new GTRenderedTexture(mTextures[i])), new CoverToggleVisual()); } } @@ -112,7 +111,7 @@ public class MetaCustomCoverItem extends Item { return true; } - public static final long getCoverDamage(final ItemStack aStack) { + public static long getCoverDamage(final ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("CustomCoverMeta"); @@ -125,7 +124,7 @@ public class MetaCustomCoverItem extends Item { return 0L; } - public static final boolean setCoverDamage(final ItemStack aStack, final long aDamage) { + public static boolean setCoverDamage(final ItemStack aStack, final long aDamage) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("CustomCoverMeta"); @@ -137,7 +136,7 @@ public class MetaCustomCoverItem extends Item { return false; } - public static final boolean getCoverConnections(final ItemStack aStack) { + public static boolean getCoverConnections(final ItemStack aStack) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("CustomCoverMeta"); @@ -150,7 +149,7 @@ public class MetaCustomCoverItem extends Item { return false; } - public static final boolean setCoverConnections(final ItemStack aStack, final boolean aConnections) { + public static boolean setCoverConnections(final ItemStack aStack, final boolean aConnections) { NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { aNBT = aNBT.getCompoundTag("CustomCoverMeta"); @@ -169,19 +168,14 @@ public class MetaCustomCoverItem extends Item { } double currentDamage = getCoverDamage(stack); double meta = stack.getItemDamage() == 0 ? 50 : 2500; - double durabilitypercent = currentDamage / meta; - return durabilitypercent; + return currentDamage / meta; } @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if (KeyboardUtils.isShiftKeyDown()) { boolean con = getCoverConnections(stack); - if (con) { - setCoverConnections(stack, false); - } else { - setCoverConnections(stack, true); - } + setCoverConnections(stack, !con); } return stack; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java index be7a0f1c99..5a1bb0eba5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java @@ -16,7 +16,7 @@ import gtPlusPlus.core.util.minecraft.PlayerUtils; public class Behaviour_Choocher extends BehaviourNone { - |
