diff options
author | Muramasa <haydenkilloh@gmail.com> | 2016-08-13 02:51:40 +0100 |
---|---|---|
committer | Technus <daniel112092@gmail.com> | 2016-09-22 18:40:19 +0200 |
commit | 436389d3f1d9ea12d05eb171eac80f30b6015d69 (patch) | |
tree | 568a0420a9a978c0c4a419d81b2b8c9db7455598 /src/main/java/gregtech/common | |
parent | ae471ca1a821a9432e9bf34d86f2c4395a3956ca (diff) | |
download | GT5-Unofficial-436389d3f1d9ea12d05eb171eac80f30b6015d69.tar.gz GT5-Unofficial-436389d3f1d9ea12d05eb171eac80f30b6015d69.tar.bz2 GT5-Unofficial-436389d3f1d9ea12d05eb171eac80f30b6015d69.zip |
For Loop Changes
Diffstat (limited to 'src/main/java/gregtech/common')
9 files changed, 44 insertions, 31 deletions
diff --git a/src/main/java/gregtech/common/GT_Worldgenerator.java b/src/main/java/gregtech/common/GT_Worldgenerator.java index 16872e9c21..9a5b2b3192 100644 --- a/src/main/java/gregtech/common/GT_Worldgenerator.java +++ b/src/main/java/gregtech/common/GT_Worldgenerator.java @@ -44,7 +44,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(); @@ -120,7 +121,7 @@ public class GT_Worldgenerator int tDimensionType = this.mWorld.provider.dimensionId; Random aRandom = new Random(); if (((tDimensionType == 1) && endAsteroids && ((mEndAsteroidProbability <= 1) || (aRandom.nextInt(mEndAsteroidProbability) == 0)))) { - short primaryMeta = 0; + short primaryMeta = 0; short secondaryMeta = 0; short betweenMeta = 0; short sporadicMeta = 0; 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 d56d3f38fe..809d7f806c 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 a7c12f5a80..69ae1edb43 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<String> 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 654e9df0bc..00668ffba8 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 @@ -159,7 +159,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 1b6b2d1b96..7e1abc30e7 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; @@ -19,6 +16,9 @@ import net.minecraft.util.EnumChatFormatting; 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; @@ -73,13 +73,14 @@ public class GT_MetaTileEntity_ElectricBlastFurnace public boolean checkRecipe(ItemStack aStack) { ArrayList<ItemStack> 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; } } @@ -88,13 +89,14 @@ public class GT_MetaTileEntity_ElectricBlastFurnace ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); ArrayList<FluidStack> 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 d28ef0fc53..7e1113f635 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 @@ -105,19 +105,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; } @@ -135,7 +138,8 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity private boolean checkTier(byte tier, ArrayList<GT_MetaTileEntity_Hatch> 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; } @@ -251,13 +255,14 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity @Override public boolean checkRecipe(ItemStack aStack) { ArrayList<FluidStack> 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 2769944f36..4ac4a227d1 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<ItemStack> 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 347d883e0d..abb6dfa4c9 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 c6ee205b1b..798be9dc9a 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, GT_Utility.safeInt((long)(actualOptimalFlow * 1.25f)))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow |