From fbdbb388c369fae549cfde3eed38b536f7461d90 Mon Sep 17 00:00:00 2001 From: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Date: Wed, 18 Oct 2023 17:03:23 +0100 Subject: Cleaning up (#767) * Kill playerAPI * Gut more events and compat that is now obsolete * Remove commented out code * Remove final modifier from methods * Make more stuff final * Remove slow building ring * Protected -> private in final classes * More cleaning * More cleaning v2 * Purging * Clean DevHelper * Clean DevHelper 2 * delete DevHelper * remove useless IFMLLoadingPlugin.MCVersion annotation from @Mod files * check for obfuscation only once in the IFMLloadingPlugin.injectData * don't instantiate the static class ASMConfig * delete unused and empty implementation of IFMLCallHook * delete empty class * delete ClassesToTransform class that just holds the class names constants * delete unused methods and unsless logging in dummymod container * delete unused transformer ClassTransformer_TT_ThaumicRestorer * spotless * Clean * Clean utils * Build checkpoint * Purge * Stage 2 * Stage 3 * Stage 4 * Stage 5 * Stage 6 * Spotless * Imports * Stage idk * Stage 1 * Fix issue * Spotless * Format numbers --------- Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Co-authored-by: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Co-authored-by: Connor Colenso --- .../xmod/gregtech/api/enums/GregtechItemList.java | 71 ++-------------------- .../gregtech/api/enums/GregtechOrePrefixes.java | 27 +++++--- .../gregtech/api/items/Gregtech_MetaItem_Base.java | 9 ++- .../xmod/gregtech/api/items/Gregtech_MetaTool.java | 5 +- ...etaTileEntity_Hatch_ElementalDataOrbHolder.java | 2 +- .../GT_MetaTileEntity_Hatch_InputBattery.java | 22 +++---- .../GT_MetaTileEntity_Hatch_Muffler_Adv.java | 5 +- .../GT_MetaTileEntity_Hatch_OutputBattery.java | 3 +- .../GT_MetaTileEntity_Hatch_Turbine.java | 5 +- .../GT_MetaTileEntity_Hatch_TurbineProvider.java | 13 ++-- .../base/GregtechMetaTransformerHiAmp.java | 4 +- .../base/GregtechMeta_MultiBlockBase.java | 28 +++------ .../base/GregtechMeta_SteamMultiBase.java | 14 ++--- .../GregtechRocketFuelGeneratorBase.java | 4 -- .../GT_MetaTileEntity_Hatch_Catalysts.java | 2 +- .../GT_MetaTileEntity_Hatch_MillingBalls.java | 2 +- .../GT_MetaTileEntity_Hatch_NbtConsumable.java | 31 ++++------ .../gregtech/api/objects/GregtechItemData.java | 20 ++---- .../api/util/SpecialBehaviourTooltipHandler.java | 2 +- 19 files changed, 88 insertions(+), 181 deletions(-) (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api') diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 90fd1e2358..ed2bc20c32 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -53,18 +53,7 @@ public enum GregtechItemList implements GregtechItemContainer { Sensor_ZPM, Sensor_UV, - // ULV Components - Electric_Motor_ULV, - Electric_Pump_ULV, - Conveyor_Module_ULV, - Electric_Piston_ULV, - Robot_Arm_ULV, - Field_Generator_ULV, - Emitter_ULV, - Sensor_ULV, - // Mixed Components - TransmissionComponent_ULV, TransmissionComponent_LV, TransmissionComponent_MV, TransmissionComponent_HV, @@ -73,7 +62,7 @@ public enum GregtechItemList implements GregtechItemContainer { TransmissionComponent_LuV, TransmissionComponent_ZPM, TransmissionComponent_UV, - TransmissionComponent_MAX, + TransmissionComponent_UHV, // Recipe Circuit Circuit_BioRecipeSelector, @@ -176,13 +165,6 @@ public enum GregtechItemList implements GregtechItemContainer { Laser_Lens_WoodsGlass, Laser_Lens_Special, - // Bombs - Bomb_Cast, - Bomb_Cast_Molten, - Bomb_Cast_Set, - Bomb_Cast_Broken, - Bomb_Cast_Mold, - // Pellet Mold Pellet_Mold, @@ -210,7 +192,7 @@ public enum GregtechItemList implements GregtechItemContainer { GTPP_Casing_LuV, GTPP_Casing_ZPM, GTPP_Casing_UV, - GTPP_Casing_MAX, + GTPP_Casing_UHV, // IronBlastFurnace Machine_Bronze_BlastFurnace Casing_IronPlatedBricks, @@ -552,7 +534,6 @@ public enum GregtechItemList implements GregtechItemContainer { Hatch_Muffler_Adv_MAX, // Super Input Busses - Hatch_SuperBus_Input_ULV, Hatch_SuperBus_Input_LV, Hatch_SuperBus_Input_MV, Hatch_SuperBus_Input_HV, @@ -564,7 +545,6 @@ public enum GregtechItemList implements GregtechItemContainer { Hatch_SuperBus_Input_MAX, // Super Output Busses - Hatch_SuperBus_Output_ULV, Hatch_SuperBus_Output_LV, Hatch_SuperBus_Output_MV, Hatch_SuperBus_Output_HV, @@ -576,10 +556,9 @@ public enum GregtechItemList implements GregtechItemContainer { Hatch_SuperBus_Output_MAX, // Chisel Buses for Industrial Chisel - GT_MetaTileEntity_ChiselBus_I, - GT_MetaTileEntity_ChiselBus_II, - GT_MetaTileEntity_ChiselBus_III, - GT_MetaTileEntity_ChiselBus_IV, + GT_MetaTileEntity_ChiselBus_LV, + GT_MetaTileEntity_ChiselBus_MV, + GT_MetaTileEntity_ChiselBus_HV, // ---------------------------------------------------------------------------- @@ -602,11 +581,6 @@ public enum GregtechItemList implements GregtechItemContainer { * Single Block Tile Entities */ - // ULV Generators - Generator_Diesel_ULV, - Generator_Gas_Turbine_ULV, - Generator_Steam_Turbine_ULV, - // Crate Box CrateStorage, @@ -616,17 +590,6 @@ public enum GregtechItemList implements GregtechItemContainer { // infinite Items Infinite_Item_Chest, - // GT4 Redstone - GT4_Redstone_Lamp, - GT4_Redstone_Button_Panel, - GT4_Redstone_Scale, - GT4_Redstone_Display, - GT4_Redstone_Circuit, - - // Gt4 Workbenches - GT4_Workbench_Bronze, - GT4_Workbench_Advanced, - // GT4 automation GT4_Electric_Auto_Workbench_LV, GT4_Electric_Auto_Workbench_MV, @@ -671,7 +634,6 @@ public enum GregtechItemList implements GregtechItemContainer { // Fancy Pollution Devices Pollution_Detector, - Pollution_Cleaner_ULV, Pollution_Cleaner_LV, Pollution_Cleaner_MV, Pollution_Cleaner_HV, @@ -702,11 +664,6 @@ public enum GregtechItemList implements GregtechItemContainer { Super_Chest_EV, Super_Chest_IV, - // Chunkloader - GT_Chunkloader_HV, - GT_Chunkloader_ZPM, - GT_Chunkloader_IV, - // Wireless Chargers Charger_LV, Charger_MV, @@ -716,7 +673,7 @@ public enum GregtechItemList implements GregtechItemContainer { Charger_LuV, Charger_ZPM, Charger_UV, - Charger_MAX, + Charger_UHV, // Reactor Processing Unit ReactorProcessingUnit_IV, @@ -752,21 +709,6 @@ public enum GregtechItemList implements GregtechItemContainer { Energy_Buffer_1by1_UV, Energy_Buffer_1by1_MAX, - // Cobble Generators - Cobble_Generator_ULV, - Cobble_Generator_LV, - Cobble_Generator_MV, - Cobble_Generator_HV, - Cobble_Generator_EV, - Cobble_Generator_IV, - Cobble_Generator_LuV, - Cobble_Generator_ZPM, - Cobble_Generator_UV, - Cobble_Generator_MAX, - - // The max Steam condenser - Condensor_MAX, - // Rocket Engines Rocket_Engine_EV, Rocket_Engine_IV, @@ -856,7 +798,6 @@ public enum GregtechItemList implements GregtechItemContainer { */ // Fluid Void Covers - Cover_Overflow_ULV, Cover_Overflow_LV, Cover_Overflow_MV, Cover_Overflow_HV, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java index 61abc48a18..03ec5f3fc5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java @@ -109,7 +109,7 @@ public enum GregtechOrePrefixes { chipset("Chipsets", "", "", true, true, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Introduced ; - public static volatile int VERSION = 508; + public static final int VERSION = 508; static { ingotHot.mHeatDamage = 3.0F; @@ -132,11 +132,11 @@ public enum GregtechOrePrefixes { mGeneratedItems = new HashSet<>(); private final ArrayList mOreProcessing = new ArrayList<>(); private final ArrayList mOreProcessingFake = new ArrayList<>(); - public ItemStack mContainerItem = null; - public ICondition mCondition = null; + public final ItemStack mContainerItem = null; + public final ICondition mCondition = null; public byte mDefaultStackSize = 64; - public GregtechMaterialStack mSecondaryMaterial = null; - public GregtechOrePrefixes mPrefixInto = this; + public final GregtechMaterialStack mSecondaryMaterial = null; + public final GregtechOrePrefixes mPrefixInto = this; public float mHeatDamage = 0.0F; // Negative for Frost Damage /** * Yes this Value can be changed to add Bits for the MetaGenerated-Item-Check. @@ -657,15 +657,22 @@ public enum GregtechOrePrefixes { mOreMultiplier = 1, mByProductMultiplier = 1, mSmeltingMultiplier = 1; public long mDensity = M; public Element mElement = null; - public GT_Materials mDirectSmelting = this, mOreReplacement = this, mMacerateInto = this, mSmeltInto = this, - mArcSmeltInto = this, mHandleMaterial = this; + public GT_Materials mDirectSmelting = this; + public GT_Materials mOreReplacement = this; + public GT_Materials mMacerateInto = this; + public GT_Materials mSmeltInto = this; + public GT_Materials mArcSmeltInto = this; + public final GT_Materials mHandleMaterial = this; public byte mToolQuality = 0; - public Fluid mSolid = null, mFluid = null, mGas = null, mPlasma = null; + public final Fluid mSolid = null; + public Fluid mFluid = null; + public Fluid mGas = null; + public Fluid mPlasma = null; /** * This Fluid is used as standard Unit for Molten Materials. 1296 is a Molten Block, what means 144 is one * Material Unit worth */ - public Fluid mStandardMoltenFluid = null; + public final Fluid mStandardMoltenFluid = null; private GT_Materials(final int aMetaItemSubID, final TextureSet aIconSet, final float aToolSpeed, final int aToolDurability, final int aToolQuality, final boolean aUnificatable) { @@ -1283,6 +1290,6 @@ public enum GregtechOrePrefixes { return this.mRGBa; } - public static volatile int VERSION = 508; + public static final int VERSION = 508; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java index 5437f65aff..e6f7933fd7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java @@ -294,7 +294,9 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item + " / " + GT_Utility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " - + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] + + GT_Utility.formatNumbers( + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 + : 1)]) + EnumChatFormatting.GRAY); } } @@ -308,7 +310,10 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item + ((tFluid == null ? "No Fluids Contained" : GT_Utility.getFluidName(tFluid, true))) + EnumChatFormatting.GRAY); aList.add( - EnumChatFormatting.BLUE + ((tFluid == null ? 0 : tFluid.amount) + "L / " + tStats[0] + "L") + EnumChatFormatting.BLUE + + (GT_Utility.formatNumbers(tFluid == null ? 0 : tFluid.amount) + "L / " + + GT_Utility.formatNumbers(tStats[0]) + + "L") + EnumChatFormatting.GRAY); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java index a66cce394d..259aa2760c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java @@ -480,10 +480,7 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool } this.doDamage(aStack, tStats.getToolDamagePerContainerCraft()); aStack = aStack.stackSize > 0 ? aStack : null; - if (playSound) { - // String sound = (aStack == null) ? tStats.getBreakingSound() : tStats.getCraftingSound(); - // GT_Utility.doSoundAtClient(sound, 1, 1.0F); - } + if (playSound) {} return aStack; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java index 6a8b3a9af6..68aaa75aa1 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java @@ -150,7 +150,7 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE } public ArrayList getInventory() { - ArrayList aContents = new ArrayList(); + ArrayList aContents = new ArrayList<>(); for (int i = getBaseMetaTileEntity().getSizeInventory() - 2; i >= 0; i--) { if (getBaseMetaTileEntity().getStackInSlot(i) != null) aContents.add(getBaseMetaTileEntity().getStackInSlot(i)); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java index 1fca67d295..254c81a515 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java @@ -128,8 +128,7 @@ public class GT_MetaTileEntity_Hatch_InputBattery extends GT_MetaTileEntity_Hatc fillStacksIntoFirstSlots(); } if (aBaseMetaTileEntity.isServerSide()) { - if (aBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity) { - MetaTileEntity mMetaTileEntity = (MetaTileEntity) aBaseMetaTileEntity.getMetaTileEntity(); + if (aBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity mMetaTileEntity) { if (mMetaTileEntity.rechargerSlotCount() > 0 && aBaseMetaTileEntity.getStoredEU() > 0) { for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) { @@ -149,11 +148,7 @@ public class GT_MetaTileEntity_Hatch_InputBattery extends GT_MetaTileEntity_Hatc } } } - } else { - // Utils.LOG_INFO("reCharger Slot Count = "+mMetaTileEntity.rechargerSlotCount()); - // Utils.LOG_INFO("getStoredEU = "+aBaseMetaTileEntity.getStoredEU()); - // Utils.LOG_INFO("getEUVar = "+mMetaTileEntity.getEUVar()); - } + } else {} } } super.onPostTick(aBaseMetaTileEntity, aTimer); @@ -202,14 +197,11 @@ public class GT_MetaTileEntity_Hatch_InputBattery extends GT_MetaTileEntity_Hatc @Override public int rechargerSlotCount() { - switch (mTier) { - case 2: - return 4; - case 4: - return 16; - default: - return 16; - } + return switch (mTier) { + case 2 -> 4; + case 4 -> 16; + default -> 16; + }; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java index d8ec187fff..8c0ebe60e9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java @@ -195,10 +195,7 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch // return; } else { // Logger.INFO("B2"); - if (this.getInventoryStack() == null) { - // Logger.INFO("D1"); - // Logger.INFO("Empty - "+this.mInventory.length); - } else { + if (this.getInventoryStack() == null) {} else { // Logger.INFO("D2"); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java index 502dd0ee0b..f70be9aa89 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java @@ -174,8 +174,7 @@ public class GT_MetaTileEntity_Hatch_OutputBattery extends GT_MetaTileEntity_Hat } if (aBaseMetaTileEntity.isServerSide()) { - if (aBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity) { - MetaTileEntity mMetaTileEntity = (MetaTileEntity) aBaseMetaTileEntity.getMetaTileEntity(); + if (aBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity mMetaTileEntity) { if (mMetaTileEntity.dechargerSlotCount() > 0 && mMetaTileEntity.getEUVar() < aBaseMetaTileEntity.getEUCapacity()) { for (int i = mMetaTileEntity.dechargerSlotStartIndex(), diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java index e8ef0a454b..0d307f6e0f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java @@ -30,7 +30,6 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GregtechMetaTileEntity_LargerTurbineBase; @@ -172,7 +171,7 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { } } - private final int getDamageToComponent(ItemStack aStack) { + private int getDamageToComponent(ItemStack aStack) { return 1; } @@ -334,7 +333,7 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { PlayerUtils.messagePlayer(aPlayer, "Using: " + aMat.mLocalizedName + " " + aSize); } } else { - this.mUsingAnimation = Utils.invertBoolean(mUsingAnimation); + this.mUsingAnimation = !mUsingAnimation; if (this.mUsingAnimation) { PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture."); } else { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java index 226086a1ff..e6cb5f8132 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java @@ -20,7 +20,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.core.util.sys.KeyboardUtils; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GregtechMetaTileEntity_LargerTurbineBase; @@ -64,20 +63,18 @@ public class GT_MetaTileEntity_Hatch_TurbineProvider extends GT_MetaTileEntity_H } } - private final void tryFindParentTurbine() { + private void tryFindParentTurbine() { Logger.INFO("This turbine housing has no parent, searching world."); IGregTechTileEntity T = this.getBaseMetaTileEntity(); World W = T.getWorld(); Chunk C = W.getChunkFromBlockCoords(T.getXCoord(), T.getZCoord()); for (Object o : C.chunkTileEntityMap.values()) { - if (o instanceof IGregTechTileEntity) { - IGregTechTileEntity G = (IGregTechTileEntity) o; + if (o instanceof IGregTechTileEntity G) { final IMetaTileEntity aMetaTileEntity = G.getMetaTileEntity(); if (aMetaTileEntity == null) { continue; } - if (aMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine) { - GT_MetaTileEntity_LargeTurbine aTurb = (GT_MetaTileEntity_LargeTurbine) aMetaTileEntity; + if (aMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine aTurb) { for (GT_MetaTileEntity_Hatch_InputBus ee : aTurb.mInputBusses) { if (ee.equals(this)) { mParent = aTurb; @@ -90,7 +87,7 @@ public class GT_MetaTileEntity_Hatch_TurbineProvider extends GT_MetaTileEntity_H } } - private final void tryRefillTurbine() { + private void tryRefillTurbine() { if (mParent == null) { tryFindParentTurbine(); } @@ -166,7 +163,7 @@ public class GT_MetaTileEntity_Hatch_TurbineProvider extends GT_MetaTileEntity_H public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer != null) { if (KeyboardUtils.isCtrlKeyDown()) { - mDescending = Utils.invertBoolean(mDescending); + mDescending = !mDescending; PlayerUtils.messagePlayer(aPlayer, "Direction: " + (mDescending ? "DOWN" : "UP")); } else { int aAmount = 0; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java index a9dd8d3a97..3701f5dd0f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java @@ -12,7 +12,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Transformer; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.PlayerUtils; public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer { @@ -108,11 +107,10 @@ public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer @Override public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - this.mHalfMode = Utils.invertBoolean(mHalfMode); + this.mHalfMode = !mHalfMode; if (this.mHalfMode) { PlayerUtils.messagePlayer(aPlayer, "Transformer is now running at 2A:8A in/out Ratio."); } else { - PlayerUtils.messagePlayer(aPlayer, "Transformer is now running at 4A:16A in/out Ratio."); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index fe394238a6..01e0f731f6 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -561,35 +561,29 @@ public abstract class GregtechMeta_MultiBlockBase { this.mWrench = false; b = true; - break; } - case 1: { + case 1 -> { this.mScrewdriver = false; b = true; - break; } - case 2: { + case 2 -> { this.mSoftHammer = false; b = true; - break; } - case 3: { + case 3 -> { this.mHardHammer = false; b = true; - break; } - case 4: { + case 4 -> { this.mSolderingTool = false; b = true; - break; } - case 5: { + case 5 -> { this.mCrowbar = false; b = true; - break; } } return b; @@ -1018,8 +1012,7 @@ public abstract class GregtechMeta_MultiBlockBase 10) { mStartUpCheck = 10; } */ @@ -1251,7 +1243,7 @@ public abstract class GregtechMeta_MultiBlockBase IStructureElement addTieredBlock(Block aBlock, BiPredicate aSetTheMeta, Function aGetTheMeta, int minMeta, int maxMeta) { - return new IStructureElement() { + return new IStructureElement<>() { @Override public boolean check(T t, World world, int x, int y, int z) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java index cd23f036da..d4db6b1350 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java @@ -32,9 +32,9 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEn public abstract class GregtechMeta_SteamMultiBase> extends GregtechMeta_MultiBlockBase { - public ArrayList mSteamInputs = new ArrayList(); - public ArrayList mSteamOutputs = new ArrayList(); - public ArrayList mSteamInputFluids = new ArrayList(); + public ArrayList mSteamInputs = new ArrayList<>(); + public ArrayList mSteamOutputs = new ArrayList<>(); + public ArrayList mSteamInputFluids = new ArrayList<>(); protected static final String TT_steaminputbus = StatCollector.translateToLocal("GTPP.MBTT.SteamInputBus"); protected static final String TT_steamoutputbus = StatCollector.translateToLocal("GTPP.MBTT.SteamOutputBus"); @@ -80,7 +80,7 @@ public abstract class GregtechMeta_SteamMultiBase getAllSteamStacks() { - ArrayList aFluids = new ArrayList(); + ArrayList aFluids = new ArrayList<>(); FluidStack aSteam = FluidUtils.getSteam(1); for (FluidStack aFluid : this.getStoredFluids()) { if (aFluid.isFluidEqual(aSteam)) { @@ -231,7 +231,7 @@ public abstract class GregtechMeta_SteamMultiBase getStoredFluids() { - ArrayList rList = new ArrayList(); + ArrayList rList = new ArrayList<>(); for (GT_MetaTileEntity_Hatch_CustomFluidBase tHatch : mSteamInputFluids) { if (isValidMetaTileEntity(tHatch) && tHatch.getFillableStack() != null) { rList.add(tHatch.getFillableStack()); @@ -242,7 +242,7 @@ public abstract class GregtechMeta_SteamMultiBase getStoredInputs() { - ArrayList rList = new ArrayList(); + ArrayList rList = new ArrayList<>(); for (GT_MetaTileEntity_Hatch_Steam_BusInput tHatch : mSteamInputs) { tHatch.mRecipeMap = getRecipeMap(); if (isValidMetaTileEntity(tHatch)) { @@ -282,7 +282,7 @@ public abstract class GregtechMeta_SteamMultiBase getStoredOutputs() { - ArrayList rList = new ArrayList(); + ArrayList rList = new ArrayList<>(); for (GT_MetaTileEntity_Hatch_Steam_BusOutput tHatch : mSteamOutputs) { if (isValidMetaTileEntity(tHatch)) { for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java index 0200113e95..cab45a9a7b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java @@ -319,10 +319,6 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ // Logger.INFO("Found some fuel?"); int aperOp = this.consumedFluidPerOperation(tLiquid); int aConsume = (int) (((long) tFuel.mSpecialValue * this.getEfficiency() * aperOp) / 100); - // Logger.INFO("Fuel Value: "+tFuel.mSpecialValue); - // Logger.INFO("Efficiency: "+getEfficiency()); - // Logger.INFO("Consumed per op: "+aperOp); - // Logger.INFO("Consuming "+aConsume); return aConsume; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_Catalysts.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_Catalysts.java index 9bf0ad3f53..b53e540044 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_Catalysts.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_Catalysts.java @@ -56,7 +56,7 @@ public class GT_MetaTileEntity_Hatch_Catalysts extends GT_MetaTileEntity_Hatch_N @Override public AutoMap getItemsValidForUsageSlots() { - return new AutoMap(); + return new AutoMap<>(); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_MillingBalls.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_MillingBalls.java index 240ed3624f..e3134f5812 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_MillingBalls.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_MillingBalls.java @@ -56,7 +56,7 @@ public class GT_MetaTileEntity_Hatch_MillingBalls extends GT_MetaTileEntity_Hatc @Override public AutoMap getItemsValidForUsageSlots() { - return new AutoMap(); + return new AutoMap<>(); } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_NbtConsumable.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_NbtConsumable.java index 5555d1ff09..53c988676f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_NbtConsumable.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_NbtConsumable.java @@ -169,7 +169,7 @@ public abstract class GT_MetaTileEntity_Hatch_NbtConsumable extends GT_MetaTileE } public final AutoMap getContentUsageSlots() { - AutoMap aItems = new AutoMap(); + AutoMap aItems = new AutoMap<>(); for (int i = mInputslotCount; i < mTotalSlotCount; i++) { if (mInventory[i] != null) { aItems.add(mInventory[i]); @@ -279,24 +279,19 @@ public abstract class GT_MetaTileEntity_Hatch_NbtConsumable extends GT_MetaTileE @Override public void addGregTechLogo(ModularWindow.Builder builder) { switch (mTotalSlotCount) { - case 8: - case 18: - builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17) - .setPos(152, 63)); - break; - case 32: - builder.widget( - new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17) - .setPos(79, 35)); - break; + case 8, 18 -> builder.widget( + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17) + .setPos(152, 63)); + case 32 -> builder.widget( + new DrawableWidget().setDrawable(getGUITextureSet().getGregTechLogo()).setSize(17, 17) + .setPos(79, 35)); } } @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { switch (mTotalSlotCount) { - case 8: + case 8 -> { builder.widget( SlotGroup.ofItemHandler(inventoryHandler, 2).startFromSlot(0).endAtSlot(3).build() .setPos(25, 25)); @@ -305,8 +300,8 @@ public abstract class GT_MetaTileEntity_Hatch_NbtConsumable extends GT_MetaTileE .build().setPos(115, 25)); builder.widget(new TextWidget("Stock").setDefaultColor(COLOR_TEXT_GRAY.get()).setPos(25, 16)) .widget(new TextWidget("Active").setDefaultColor(COLOR_TEXT_GRAY.get()).setPos(115, 16)); - break; - case 18: + } + case 18 -> { builder.widget( SlotGroup.ofItemHandler(inventoryHandler, 3).startFromSlot(0).endAtSlot(8).build() .setPos(25, 19)); @@ -315,15 +310,15 @@ public abstract class GT_MetaTileEntity_Hatch_NbtConsumable extends GT_MetaTileE .build().setPos(97, 19)); builder.widget(new TextWidget("Stock").setDefaultColor(COLOR_TEXT_GRAY.get()).setPos(25, 14)) .widget(new TextWidget("Active").setDefaultColor(COLOR_TEXT_GRAY.get()).setPos(15, 14)); - break; - case 32: + } + case 32 -> { builder.widget( SlotGroup.ofItemHandler(inventoryHandler, 4).startFromSlot(0).endAtSlot(15).build() .setPos(7, 7)); builder.widget( SlotGroup.ofItemHandler(inventoryHandler, 4).startFromSlot(16).endAtSlot(31).canInsert(false) .build().setPos(96, 7)); - break; + } } } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java index b9dc5d4b70..77ad6cd4ac 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/objects/GregtechItemData.java @@ -2,8 +2,6 @@ package gtPlusPlus.xmod.gregtech.api.objects; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; import java.util.List; import net.minecraft.item.ItemStack; @@ -47,9 +45,9 @@ public class GregtechItemData { final GregtechMaterialStack[] tByProducts = aByProducts.length < 1 ? EMPTY_GT_MaterialStack_ARRAY : new GregtechMaterialStack[aByProducts.length]; int j = 0; - for (int i = 0; i < aByProducts.length; i++) { - if ((aByProducts[i] != null) && (aByProducts[i].mMaterial != null)) { - tByProducts[j++] = aByProducts[i].clone(); + for (GregtechMaterialStack aByProduct : aByProducts) { + if ((aByProduct != null) && (aByProduct.mMaterial != null)) { + tByProducts[j++] = aByProduct.clone(); } } this.mByProducts = j > 0 ? new GregtechMaterialStack[j] : EMPTY_GT_MaterialStack_ARRAY; @@ -102,13 +100,7 @@ public class GregtechItemData { } } - Collections.sort(rList, new Comparator() { - - @Override - public int compare(final GregtechMaterialStack a, final GregtechMaterialStack b) { - return a.mAmount == b.mAmount ? 0 : a.mAmount > b.mAmount ? -1 : +1; - } - }); + rList.sort((a, b) -> Long.compare(b.mAmount, a.mAmount)); if (rList.isEmpty()) { this.mMaterial = null; @@ -117,7 +109,7 @@ public class GregtechItemData { rList.remove(0); } - this.mByProducts = rList.toArray(new GregtechMaterialStack[rList.size()]); + this.mByProducts = rList.toArray(new GregtechMaterialStack[0]); } public boolean hasValidPrefixMaterialData() { @@ -133,7 +125,7 @@ public class GregtechItemData { } public ArrayList getAllGT_MaterialStacks() { - final ArrayList rList = new ArrayList(); + final ArrayList rList = new ArrayList<>(); if (this.hasValidMaterialData()) { rList.add(this.mMaterial); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java index 51987d84fd..df95b7de2b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java @@ -11,7 +11,7 @@ import gregtech.api.util.GT_Utility; public class SpecialBehaviourTooltipHandler { - private static final HashMap mTooltipCache = new HashMap(); + private static final HashMap mTooltipCache = new HashMap<>(); public static void addTooltipForItem(ItemStack aStack, String aTooltip) { mTooltipCache.put(aStack, aTooltip); -- cgit