From 7d3615d74a2616855783c4900455d3fc294f3ee3 Mon Sep 17 00:00:00 2001 From: Muramasa Date: Sat, 13 Aug 2016 02:51:40 +0100 Subject: [PATCH] For loop changes --- src/main/java/gregtech/GT_Mod.java | 3 +- .../java/gregtech/api/enums/Materials.java | 7 ++- .../api/items/GT_MetaGenerated_Item.java | 6 +- .../gregtech/api/objects/GT_ArrayList.java | 9 +-- .../java/gregtech/api/util/GT_ModHandler.java | 55 +++++++++---------- .../gregtech/common/GT_Worldgenerator.java | 3 +- .../items/behaviors/Behaviour_DataStick.java | 4 +- .../items/behaviors/Behaviour_Scanner.java | 3 +- .../GT_MetaTileEntity_DistillationTower.java | 3 +- ...T_MetaTileEntity_ElectricBlastFurnace.java | 24 ++++---- .../GT_MetaTileEntity_FusionComputer.java | 21 ++++--- ...GT_MetaTileEntity_ImplosionCompressor.java | 9 +-- .../GT_MetaTileEntity_LargeTurbine_Gas.java | 3 +- ...GT_MetaTileEntity_LargeTurbine_Plasma.java | 3 +- .../loaders/misc/GT_Achievements.java | 14 +++-- .../loaders/oreprocessing/ProcessingDust.java | 3 +- 16 files changed, 94 insertions(+), 76 deletions(-) diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index e2062f9a..a89fceff 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -348,7 +348,8 @@ public class GT_Mod List tModList = tLoadController.getActiveModList(); List tNewModsList = new ArrayList(); ModContainer tGregTech = null; - for (short i = 0; i < tModList.size(); i = (short) (i + 1)) { + short tModList_sS= (short) tModList.size(); + for (short i = 0; i < tModList_sS; i = (short) (i + 1)) { ModContainer tMod = (ModContainer) tModList.get(i); if (tMod.getModId().equalsIgnoreCase("gregtech")) { tGregTech = tMod; diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index 20022aa2..2175e924 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -1,7 +1,5 @@ package gregtech.api.enums; -import java.util.*; - import cpw.mods.fml.common.Loader; import gregtech.api.GregTech_API; import gregtech.api.enums.TC_Aspects.TC_AspectStack; @@ -17,6 +15,8 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; +import java.util.*; + import static gregtech.api.enums.GT_Values.M; import static gregtech.api.enums.GT_Values.MOD_ID_TC; @@ -1506,7 +1506,8 @@ public enum Materials implements IColorModulationContainer, ISubTagContainer { public boolean remove(ItemStack aStack) { if (aStack == null) return false; boolean temp = false; - for (int i = 0; i < mMaterialItems.size(); i++) + int mMaterialItems_sS=mMaterialItems.size(); + for (int i = 0; i < mMaterialItems_sS; i++) if (GT_Utility.areStacksEqual(aStack, mMaterialItems.get(i))) { mMaterialItems.remove(i--); temp = true; diff --git a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java index a246e83d..72b1485a 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Item.java @@ -299,7 +299,8 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements @Override @SideOnly(Side.CLIENT) public void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) { - for (int i = 0, j = mEnabledItems.length(); i < j; i++) + int j = mEnabledItems.length(); + for (int i = 0; i < j; i++) if (mVisibleItems.get(i) || (D1 && mEnabledItems.get(i))) { Long[] tStats = mElectricStats.get((short) (mOffset + i)); if (tStats != null && tStats[3] < 0) { @@ -319,7 +320,8 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements @Override @SideOnly(Side.CLIENT) public final void registerIcons(IIconRegister aIconRegister) { - for (short i = 0, j = (short) mEnabledItems.length(); i < j; i++) + short j = (short) mEnabledItems.length(); + for (short i = 0; i < j; i++) if (mEnabledItems.get(i)) { for (byte k = 1; k < mIconList[i].length; k++) { mIconList[i][k] = aIconRegister.registerIcon(RES_PATH_ITEM + (GT_Config.troll ? "troll" : getUnlocalizedName() + "/" + i + "/" + k)); diff --git a/src/main/java/gregtech/api/objects/GT_ArrayList.java b/src/main/java/gregtech/api/objects/GT_ArrayList.java index 5bc781e2..d16974bc 100644 --- a/src/main/java/gregtech/api/objects/GT_ArrayList.java +++ b/src/main/java/gregtech/api/objects/GT_ArrayList.java @@ -6,6 +6,7 @@ import java.util.Collection; public class GT_ArrayList extends ArrayList { private static final long serialVersionUID = 1L; + private int size_sS; private final boolean mAllowNulls; @@ -17,13 +18,13 @@ public class GT_ArrayList extends ArrayList { public GT_ArrayList(boolean aAllowNulls, E... aArray) { super(Arrays.asList(aArray)); mAllowNulls = aAllowNulls; - if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); + if (!mAllowNulls) {size_sS=size(); for (int i = 0; i < size_sS; i++) if (get(i) == null) {remove(i--);size_sS=size();}} } public GT_ArrayList(boolean aAllowNulls, Collection aList) { super(aList); mAllowNulls = aAllowNulls; - if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); + if (!mAllowNulls) {size_sS=size(); for (int i = 0; i < size_sS; i++) if (get(i) == null) {remove(i--);size_sS=size();}} } @Override @@ -46,14 +47,14 @@ public class GT_ArrayList extends ArrayList { @Override public boolean addAll(Collection aList) { boolean rReturn = super.addAll(aList); - if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); + if (!mAllowNulls) {size_sS=size(); for (int i = 0; i < size_sS; i++) if (get(i) == null) {remove(i--);size_sS=size();}} return rReturn; } @Override public boolean addAll(int aIndex, Collection aList) { boolean rReturn = super.addAll(aIndex, aList); - if (!mAllowNulls) for (int i = 0; i < size(); i++) if (get(i) == null) remove(i--); + if (!mAllowNulls) {size_sS=size(); for (int i = 0; i < size_sS; i++) if (get(i) == null) {remove(i--);size_sS=size();}} return rReturn; } } \ No newline at end of file diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index be85ca29..8162360f 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -951,11 +951,12 @@ public class GT_ModHandler { if (aOnlyAddIfThereIsAnyRecipeOutputtingThis && !tThereWasARecipe) { ArrayList tList = (ArrayList) CraftingManager.getInstance().getRecipeList(); - for (int i = 0; i < tList.size() && !tThereWasARecipe; i++) { + int tList_sS=tList.size(); + for (int i = 0; i < tList_sS && !tThereWasARecipe; i++) { IRecipe tRecipe = tList.get(i); if (sSpecialRecipeClasses.contains(tRecipe.getClass().getName())) continue; if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(tRecipe.getRecipeOutput()), aResult, true)) { - tList.remove(i--); + tList.remove(i--); tList_sS=tList.size(); tThereWasARecipe = true; } } @@ -1091,18 +1092,16 @@ public class GT_ModHandler { }, 3, 3); for (int i = 0; i < aRecipe.length && i < 9; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); ArrayList tList = (ArrayList) CraftingManager.getInstance().getRecipeList(); - for (int i = 0; i < tList.size(); i++) { - try { - for (; i < tList.size(); i++) { + int tList_sS=tList.size(); + try { + for (int i = 0; i < tList_sS; i++) { + for (; i < tList_sS; i++) { if ((!(tList.get(i) instanceof IGT_CraftingRecipe) || ((IGT_CraftingRecipe) tList.get(i)).isRemovable()) && tList.get(i).matches(aCrafting, DW)) { rReturn = tList.get(i).getCraftingResult(aCrafting); - if (rReturn != null) tList.remove(i--); + if (rReturn != null) tList.remove(i--); tList_sS=tList.size(); } } - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } - } + }} catch (Throwable e) {e.printStackTrace(GT_Log.err);} return rReturn; } @@ -1121,7 +1120,8 @@ public class GT_ModHandler { boolean rReturn = false; ArrayList tList = (ArrayList) CraftingManager.getInstance().getRecipeList(); aOutput = GT_OreDictUnificator.get(aOutput); - for (int i = 0; i < tList.size(); i++) { + int tList_sS=tList.size(); + for (int i = 0; i < tList_sS; i++) { IRecipe tRecipe = tList.get(i); if (aNotRemoveShapelessRecipes && (tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe)) continue; @@ -1132,7 +1132,7 @@ public class GT_ModHandler { } ItemStack tStack = tRecipe.getRecipeOutput(); if ((!(tRecipe instanceof IGT_CraftingRecipe) || ((IGT_CraftingRecipe) tRecipe).isRemovable()) && GT_Utility.areStacksEqual(GT_OreDictUnificator.get(tStack), aOutput, aIgnoreNBT)) { - tList.remove(i--); + tList.remove(i--); tList_sS=tList.size(); rReturn = true; } } @@ -1169,11 +1169,12 @@ public class GT_ModHandler { sAllRecipeList.clear(); sAllRecipeList.addAll(tList); } - for (int i = 0, j = sAllRecipeList.size(); i < j; i++) { + int sAllRecipeList_sS=sAllRecipeList.size(); + for (int i = 0, j = sAllRecipeList_sS; i < j; i++) { IRecipe tRecipe = sAllRecipeList.get(i); if (tRecipe.matches(aCrafting, aWorld)) { if (i > 10) { - sAllRecipeList.remove(i); + sAllRecipeList.remove(i); sAllRecipeList_sS=sAllRecipeList.size(); sAllRecipeList.add(i - 10, tRecipe); } return tRecipe.getCraftingResult(aCrafting); @@ -1233,13 +1234,11 @@ public class GT_ModHandler { }, 3, 3); for (int i = 0; i < 9 && i < aRecipe.length; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); ArrayList tList = (ArrayList) CraftingManager.getInstance().getRecipeList(); - for (int i = 0; i < tList.size(); i++) { + int tList_sS=tList.size(); + try { + for (int i = 0; i < tList_sS; i++) { temp = false; - try { - temp = tList.get(i).matches(aCrafting, DW); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } + temp = tList.get(i).matches(aCrafting, DW); if (temp) { ItemStack tOutput = aUncopiedStack ? tList.get(i).getRecipeOutput() : tList.get(i).getCraftingResult(aCrafting); if (tOutput == null || tOutput.stackSize <= 0) { @@ -1251,7 +1250,7 @@ public class GT_ModHandler { return GT_Utility.copy(tOutput); } } - } + }} catch (Throwable e) {e.printStackTrace(GT_Log.err);} return null; } @@ -1335,13 +1334,11 @@ public class GT_ModHandler { } }, 3, 3); for (int i = 0; i < 9 && i < aRecipe.length; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); - for (int i = 0; i < aList.size(); i++) { + int aList_sS=aList.size(); + try { + for (int i = 0; i < aList_sS; i++) { temp = false; - try { - temp = aList.get(i).matches(aCrafting, DW); - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } + temp = aList.get(i).matches(aCrafting, DW); if (temp) { ItemStack tOutput = aList.get(i).getCraftingResult(aCrafting); if (tOutput == null || tOutput.stackSize <= 0) { @@ -1350,10 +1347,10 @@ public class GT_ModHandler { throw new GT_ItsNotMyFaultException("Seems another Mod added a Crafting Recipe with null Output. Tell the Developer of said Mod to fix that."); } else { rList.add(GT_Utility.copy(tOutput)); - if (aDeleteFromList) aList.remove(i--); + if (aDeleteFromList) aList.remove(i--); aList_sS=aList.size(); } } - } + }} catch (Throwable e) {e.printStackTrace(GT_Log.err);} return rList; } diff --git a/src/main/java/gregtech/common/GT_Worldgenerator.java b/src/main/java/gregtech/common/GT_Worldgenerator.java index 5b8432e4..64f034c3 100644 --- a/src/main/java/gregtech/common/GT_Worldgenerator.java +++ b/src/main/java/gregtech/common/GT_Worldgenerator.java @@ -51,7 +51,8 @@ public class GT_Worldgenerator this.mList.add(new WorldGenContainer(new XSTR(aRandom.nextInt()), aX * 16, aZ * 16, ((aChunkGenerator instanceof ChunkProviderEnd)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.sky) ? 1 : ((aChunkGenerator instanceof ChunkProviderHell)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.hell) ? -1 : 0, aWorld, aChunkGenerator, aChunkProvider, aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8).biomeName)); if (!this.mIsGenerating) { this.mIsGenerating = true; - for (int i = 0; i < this.mList.size(); i++) { + int mList_sS=this.mList.size(); + for (int i = 0; i < mList_sS; i++) { ((Runnable) this.mList.get(i)).run(); } this.mList.clear(); diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java index 105c3902..38a9f6fa 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_DataStick.java @@ -24,8 +24,8 @@ public class Behaviour_DataStick tString = GT_Utility.ItemNBT.getPunchCardData(aStack); if (GT_Utility.isStringValid(tString)) { aList.add("Punch Card Data"); - int i = 0; - for (int j = tString.length(); i < j; i += 64) { + int i = 0;int j = tString.length(); + for (; i < j; i += 64) { aList.add(tString.substring(i, Math.min(i + 64, j))); } } diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java index efea09bc..187027a5 100644 --- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java +++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Scanner.java @@ -22,7 +22,8 @@ public class Behaviour_Scanner if (((aPlayer instanceof EntityPlayerMP)) && (aItem.canUse(aStack, 20000.0D))) { ArrayList tList = new ArrayList(); if (aItem.use(aStack, GT_Utility.getCoordinateScan(tList, aPlayer, aWorld, 1, aX, aY, aZ, aSide, hitX, hitY, hitZ), aPlayer)) { - for (int i = 0; i < tList.size(); i++) { + int tList_sS=tList.size(); + for (int i = 0; i < tList_sS; i++) { GT_Utility.sendChatToPlayer(aPlayer, (String) tList.get(i)); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java index a241817e..493f4407 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java @@ -161,7 +161,8 @@ public class GT_MetaTileEntity_DistillationTower return false; } GT_MetaTileEntity_Hatch_Output[] tmpHatches = new GT_MetaTileEntity_Hatch_Output[5]; - for (int i = 0; i < this.mOutputHatches.size(); i++) { + int mOutputHatches_sS=this.mOutputHatches.size(); + for (int i = 0; i < mOutputHatches_sS; i++) { int hatchNumber = this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() - 1 - height; if (tmpHatches[hatchNumber] == null) { tmpHatches[hatchNumber] = this.mOutputHatches.get(i); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java index 62189600..a341a47d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java @@ -1,8 +1,5 @@ package gregtech.common.tileentities.machines.multi; -import java.util.ArrayList; -import java.util.Arrays; - import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -18,6 +15,9 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; +import java.util.ArrayList; +import java.util.Arrays; + public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_MultiBlockBase { private int mHeatingCapacity = 0; @@ -72,13 +72,14 @@ public class GT_MetaTileEntity_ElectricBlastFurnace public boolean checkRecipe(ItemStack aStack) { ArrayList tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { + int tInputList_sS=tInputList.size(); + for (int i = 0; i < tInputList_sS - 1; i++) { + for (int j = i + 1; j < tInputList_sS; j++) { if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); + tInputList.remove(j--); tInputList_sS=tInputList.size(); } else { - tInputList.remove(i--); + tInputList.remove(i--); tInputList_sS=tInputList.size(); break; } } @@ -87,13 +88,14 @@ public class GT_MetaTileEntity_ElectricBlastFurnace ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); ArrayList tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { + int tFluidList_sS=tFluidList.size(); + for (int i = 0; i < tFluidList_sS - 1; i++) { + for (int j = i + 1; j < tFluidList_sS; j++) { if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); + tFluidList.remove(j--); tFluidList_sS=tFluidList.size(); } else { - tFluidList.remove(i--); + tFluidList.remove(i--); tFluidList_sS=tFluidList.size(); break; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java index 7d950a49..9022cddf 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java @@ -104,19 +104,22 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity && (addIfInjector(xCenter - 6, yCenter - 1, zCenter - 1, aBaseMetaTileEntity)) && (addIfInjector(xCenter + 6, yCenter - 1, zCenter - 1, aBaseMetaTileEntity)) && (this.mEnergyHatches.size() >= 1) && (this.mOutputHatches.size() >= 1) && (this.mInputHatches.size() >= 2)) { if (this.mEnergyHatches != null) { - for (int i = 0; i < this.mEnergyHatches.size(); i++) { + int mEnergyHatches_sS=this.mEnergyHatches.size(); + for (int i = 0; i < mEnergyHatches_sS; i++) { if (this.mEnergyHatches.get(i).mTier < tier()) return false; } } if (this.mOutputHatches != null) { - for (int i = 0; i < this.mOutputHatches.size(); i++) { + int mOutputHatches_sS=this.mOutputHatches.size(); + for (int i = 0; i < mOutputHatches_sS; i++) { if (this.mOutputHatches.get(i).mTier < tier()) return false; } } if (this.mInputHatches != null) { - for (int i = 0; i < this.mInputHatches.size(); i++) { + int mInputHatches_sS=this.mInputHatches.size(); + for (int i = 0; i < mInputHatches_sS; i++) { if (this.mInputHatches.get(i).mTier < tier()) return false; } @@ -134,7 +137,8 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity private boolean checkTier(byte tier, ArrayList list) { if (list != null) { - for (int i = 0; i < list.size(); i++) { + int list_sS=list.size(); + for (int i = 0; i < list_sS; i++) { if (list.get(i).mTier < tier) { return false; } @@ -250,13 +254,14 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity @Override public boolean checkRecipe(ItemStack aStack) { ArrayList tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { + int tFluidList_sS=tFluidList.size(); + for (int i = 0; i < tFluidList_sS - 1; i++) { + for (int j = i + 1; j < tFluidList_sS; j++) { if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); + tFluidList.remove(j--); tFluidList_sS=tFluidList.size(); } else { - tFluidList.remove(i--); + tFluidList.remove(i--); tFluidList_sS=tFluidList.size(); break; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java index 6d61e2b0..c5f6f111 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java @@ -69,13 +69,14 @@ public class GT_MetaTileEntity_ImplosionCompressor public boolean checkRecipe(ItemStack aStack) { ArrayList tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { + int tInputList_sS=tInputList.size(); + for (int i = 0; i < tInputList_sS - 1; i++) { + for (int j = i + 1; j < tInputList_sS; j++) { if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); + tInputList.remove(j--); tInputList_sS=tInputList.size(); } else { - tInputList.remove(i--); + tInputList.remove(i--); tInputList_sS=tInputList.size(); break; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java index c5507e0b..596ff5ec 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java @@ -95,7 +95,8 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT int flow = 0; int totalFlow = 0; - for (int i = 0; i < aFluids.size(); i++) { + int aFluids_sS=aFluids.size(); + for (int i = 0; i < aFluids_sS; i++) { if (aFluids.get(i).isFluidEqual(firstFuelType)) { flow = aFluids.get(i).amount; // Get all (steam) in hatch flow = Math.min(flow, Math.min(remainingFlow, (int) (actualOptimalFlow * 1.25f))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java index 923eaabc..73b87ec7 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java @@ -99,7 +99,8 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar int flow = 0; int totalFlow = 0; - for (int i = 0; i < aFluids.size(); i++) { + int aFluids_sS=aFluids.size(); + for (int i = 0; i < aFluids_sS; i++) { if (aFluids.get(i).isFluidEqual(firstFuelType)) { flow = aFluids.get(i).amount; // Get all (steam) in hatch flow = Math.min(flow, Math.min(remainingFlow, (int) (actualOptimalFlow * 1.25f))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow diff --git a/src/main/java/gregtech/loaders/misc/GT_Achievements.java b/src/main/java/gregtech/loaders/misc/GT_Achievements.java index c0274327..f16aa8a0 100644 --- a/src/main/java/gregtech/loaders/misc/GT_Achievements.java +++ b/src/main/java/gregtech/loaders/misc/GT_Achievements.java @@ -1,9 +1,5 @@ package gregtech.loaders.misc; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @@ -33,6 +29,10 @@ import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.fluids.FluidStack; import thaumcraft.api.ThaumcraftApiHelper; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + public class GT_Achievements { public static List oreList = new ArrayList(); @@ -46,7 +46,8 @@ public class GT_Achievements { public GT_Achievements() { this.achievementList = new HashMap(); this.issuedAchievements = new HashMap(); - for (int i = 0; i < oreList.size(); i++) { + int oreList_sS=oreList.size(); + for (int i = 0; i < oreList_sS; i++) { if (GT_Values.D1 && this.achievementList.get(oreList.get(i).name()) == null) { GT_Log.out.println("achievement." + oreList.get(i).name() + "=Find " + oreList.get(i).name() + " Ore"); @@ -497,7 +498,8 @@ public class GT_Achievements { } } else if (data.mPrefix == OrePrefixes.ore || data.mPrefix == OrePrefixes.oreBlackgranite || data.mPrefix == OrePrefixes.oreEndstone || data.mPrefix == OrePrefixes.oreNetherrack || data.mPrefix == OrePrefixes.oreRedgranite) { - for (int i = 0; i < data.getAllMaterialStacks().size(); i++) { + int data_getAllMaterialStacks_sS=data.getAllMaterialStacks().size(); + for (int i = 0; i < data_getAllMaterialStacks_sS; i++) { issueAchievement(player, data.getAllMaterialStacks().get(i).mMaterial.name()); if (data.getAllMaterialStacks().get(i).mMaterial == Materials.AnyIron) { issueAchievement(player, "iron"); diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java index ee9665d8..fd8d327e 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java @@ -88,7 +88,8 @@ public class ProcessingDust implements gregtech.api.interfaces.IOreRecipeRegistr tItemAmount = (tItemAmount * tDensityMultiplier % aMaterial.getDensity() > 0L ? 1 : 0) + tItemAmount * tDensityMultiplier / aMaterial.getDensity(); if (tList.size() > 0) { FluidStack tFluid = null; - for (int i = 0; i < tList.size(); i++) { + int tList_sS=tList.size(); + for (int i = 0; i < tList_sS; i++) { if ((!ItemList.Cell_Air.isStackEqual(tList.get(i))) && ((tFluid = GT_Utility.getFluidForFilledItem((ItemStack) tList.get(i), true)) != null)) { tFluid.amount *= ((ItemStack) tList.get(i)).stackSize; tCapsuleCount -= GT_ModHandler.getCapsuleCellContainerCountMultipliedWithStackSize(new ItemStack[]{(ItemStack) tList.get(i)});