For loop changes

This commit is contained in:
Muramasa 2016-08-13 02:51:40 +01:00
parent ce1195d48c
commit 7d3615d74a
16 changed files with 94 additions and 76 deletions

View file

@ -348,7 +348,8 @@ public class GT_Mod
List<ModContainer> tModList = tLoadController.getActiveModList(); List<ModContainer> tModList = tLoadController.getActiveModList();
List<ModContainer> tNewModsList = new ArrayList(); List<ModContainer> tNewModsList = new ArrayList();
ModContainer tGregTech = null; 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); ModContainer tMod = (ModContainer) tModList.get(i);
if (tMod.getModId().equalsIgnoreCase("gregtech")) { if (tMod.getModId().equalsIgnoreCase("gregtech")) {
tGregTech = tMod; tGregTech = tMod;

View file

@ -1,7 +1,5 @@
package gregtech.api.enums; package gregtech.api.enums;
import java.util.*;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import gregtech.api.GregTech_API; import gregtech.api.GregTech_API;
import gregtech.api.enums.TC_Aspects.TC_AspectStack; 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.Fluid;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import java.util.*;
import static gregtech.api.enums.GT_Values.M; import static gregtech.api.enums.GT_Values.M;
import static gregtech.api.enums.GT_Values.MOD_ID_TC; 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) { public boolean remove(ItemStack aStack) {
if (aStack == null) return false; if (aStack == null) return false;
boolean temp = 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))) { if (GT_Utility.areStacksEqual(aStack, mMaterialItems.get(i))) {
mMaterialItems.remove(i--); mMaterialItems.remove(i--);
temp = true; temp = true;

View file

@ -299,7 +299,8 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) { 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))) { if (mVisibleItems.get(i) || (D1 && mEnabledItems.get(i))) {
Long[] tStats = mElectricStats.get((short) (mOffset + i)); Long[] tStats = mElectricStats.get((short) (mOffset + i));
if (tStats != null && tStats[3] < 0) { if (tStats != null && tStats[3] < 0) {
@ -319,7 +320,8 @@ public abstract class GT_MetaGenerated_Item extends GT_MetaBase_Item implements
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public final void registerIcons(IIconRegister aIconRegister) { 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)) { if (mEnabledItems.get(i)) {
for (byte k = 1; k < mIconList[i].length; k++) { for (byte k = 1; k < mIconList[i].length; k++) {
mIconList[i][k] = aIconRegister.registerIcon(RES_PATH_ITEM + (GT_Config.troll ? "troll" : getUnlocalizedName() + "/" + i + "/" + k)); mIconList[i][k] = aIconRegister.registerIcon(RES_PATH_ITEM + (GT_Config.troll ? "troll" : getUnlocalizedName() + "/" + i + "/" + k));

View file

@ -6,6 +6,7 @@ import java.util.Collection;
public class GT_ArrayList<E> extends ArrayList<E> { public class GT_ArrayList<E> extends ArrayList<E> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private int size_sS;
private final boolean mAllowNulls; private final boolean mAllowNulls;
@ -17,13 +18,13 @@ public class GT_ArrayList<E> extends ArrayList<E> {
public GT_ArrayList(boolean aAllowNulls, E... aArray) { public GT_ArrayList(boolean aAllowNulls, E... aArray) {
super(Arrays.asList(aArray)); super(Arrays.asList(aArray));
mAllowNulls = aAllowNulls; 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<? extends E> aList) { public GT_ArrayList(boolean aAllowNulls, Collection<? extends E> aList) {
super(aList); super(aList);
mAllowNulls = aAllowNulls; 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 @Override
@ -46,14 +47,14 @@ public class GT_ArrayList<E> extends ArrayList<E> {
@Override @Override
public boolean addAll(Collection<? extends E> aList) { public boolean addAll(Collection<? extends E> aList) {
boolean rReturn = super.addAll(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; return rReturn;
} }
@Override @Override
public boolean addAll(int aIndex, Collection<? extends E> aList) { public boolean addAll(int aIndex, Collection<? extends E> aList) {
boolean rReturn = super.addAll(aIndex, 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; return rReturn;
} }
} }

View file

@ -951,11 +951,12 @@ public class GT_ModHandler {
if (aOnlyAddIfThereIsAnyRecipeOutputtingThis && !tThereWasARecipe) { if (aOnlyAddIfThereIsAnyRecipeOutputtingThis && !tThereWasARecipe) {
ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); ArrayList<IRecipe> tList = (ArrayList<IRecipe>) 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); IRecipe tRecipe = tList.get(i);
if (sSpecialRecipeClasses.contains(tRecipe.getClass().getName())) continue; if (sSpecialRecipeClasses.contains(tRecipe.getClass().getName())) continue;
if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(tRecipe.getRecipeOutput()), aResult, true)) { if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(tRecipe.getRecipeOutput()), aResult, true)) {
tList.remove(i--); tList.remove(i--); tList_sS=tList.size();
tThereWasARecipe = true; tThereWasARecipe = true;
} }
} }
@ -1091,18 +1092,16 @@ public class GT_ModHandler {
}, 3, 3); }, 3, 3);
for (int i = 0; i < aRecipe.length && i < 9; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); for (int i = 0; i < aRecipe.length && i < 9; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]);
ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList();
for (int i = 0; i < tList.size(); i++) { int tList_sS=tList.size();
try { try {
for (; i < tList.size(); i++) { 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)) { 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); 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) { }} catch (Throwable e) {e.printStackTrace(GT_Log.err);}
e.printStackTrace(GT_Log.err);
}
}
return rReturn; return rReturn;
} }
@ -1121,7 +1120,8 @@ public class GT_ModHandler {
boolean rReturn = false; boolean rReturn = false;
ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList();
aOutput = GT_OreDictUnificator.get(aOutput); 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); IRecipe tRecipe = tList.get(i);
if (aNotRemoveShapelessRecipes && (tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe)) if (aNotRemoveShapelessRecipes && (tRecipe instanceof ShapelessRecipes || tRecipe instanceof ShapelessOreRecipe))
continue; continue;
@ -1132,7 +1132,7 @@ public class GT_ModHandler {
} }
ItemStack tStack = tRecipe.getRecipeOutput(); ItemStack tStack = tRecipe.getRecipeOutput();
if ((!(tRecipe instanceof IGT_CraftingRecipe) || ((IGT_CraftingRecipe) tRecipe).isRemovable()) && GT_Utility.areStacksEqual(GT_OreDictUnificator.get(tStack), aOutput, aIgnoreNBT)) { 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; rReturn = true;
} }
} }
@ -1169,11 +1169,12 @@ public class GT_ModHandler {
sAllRecipeList.clear(); sAllRecipeList.clear();
sAllRecipeList.addAll(tList); 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); IRecipe tRecipe = sAllRecipeList.get(i);
if (tRecipe.matches(aCrafting, aWorld)) { if (tRecipe.matches(aCrafting, aWorld)) {
if (i > 10) { if (i > 10) {
sAllRecipeList.remove(i); sAllRecipeList.remove(i); sAllRecipeList_sS=sAllRecipeList.size();
sAllRecipeList.add(i - 10, tRecipe); sAllRecipeList.add(i - 10, tRecipe);
} }
return tRecipe.getCraftingResult(aCrafting); return tRecipe.getCraftingResult(aCrafting);
@ -1233,13 +1234,11 @@ public class GT_ModHandler {
}, 3, 3); }, 3, 3);
for (int i = 0; i < 9 && i < aRecipe.length; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); for (int i = 0; i < 9 && i < aRecipe.length; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]);
ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance().getRecipeList(); ArrayList<IRecipe> tList = (ArrayList<IRecipe>) 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; temp = false;
try { temp = tList.get(i).matches(aCrafting, DW);
temp = tList.get(i).matches(aCrafting, DW);
} catch (Throwable e) {
e.printStackTrace(GT_Log.err);
}
if (temp) { if (temp) {
ItemStack tOutput = aUncopiedStack ? tList.get(i).getRecipeOutput() : tList.get(i).getCraftingResult(aCrafting); ItemStack tOutput = aUncopiedStack ? tList.get(i).getRecipeOutput() : tList.get(i).getCraftingResult(aCrafting);
if (tOutput == null || tOutput.stackSize <= 0) { if (tOutput == null || tOutput.stackSize <= 0) {
@ -1251,7 +1250,7 @@ public class GT_ModHandler {
return GT_Utility.copy(tOutput); return GT_Utility.copy(tOutput);
} }
} }
} }} catch (Throwable e) {e.printStackTrace(GT_Log.err);}
return null; return null;
} }
@ -1335,13 +1334,11 @@ public class GT_ModHandler {
} }
}, 3, 3); }, 3, 3);
for (int i = 0; i < 9 && i < aRecipe.length; i++) aCrafting.setInventorySlotContents(i, aRecipe[i]); 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; temp = false;
try { temp = aList.get(i).matches(aCrafting, DW);
temp = aList.get(i).matches(aCrafting, DW);
} catch (Throwable e) {
e.printStackTrace(GT_Log.err);
}
if (temp) { if (temp) {
ItemStack tOutput = aList.get(i).getCraftingResult(aCrafting); ItemStack tOutput = aList.get(i).getCraftingResult(aCrafting);
if (tOutput == null || tOutput.stackSize <= 0) { 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."); throw new GT_ItsNotMyFaultException("Seems another Mod added a Crafting Recipe with null Output. Tell the Developer of said Mod to fix that.");
} else { } else {
rList.add(GT_Utility.copy(tOutput)); 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; return rList;
} }

View file

@ -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)); 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) { if (!this.mIsGenerating) {
this.mIsGenerating = true; 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(); ((Runnable) this.mList.get(i)).run();
} }
this.mList.clear(); this.mList.clear();

View file

@ -24,8 +24,8 @@ public class Behaviour_DataStick
tString = GT_Utility.ItemNBT.getPunchCardData(aStack); tString = GT_Utility.ItemNBT.getPunchCardData(aStack);
if (GT_Utility.isStringValid(tString)) { if (GT_Utility.isStringValid(tString)) {
aList.add("Punch Card Data"); aList.add("Punch Card Data");
int i = 0; int i = 0;int j = tString.length();
for (int j = tString.length(); i < j; i += 64) { for (; i < j; i += 64) {
aList.add(tString.substring(i, Math.min(i + 64, j))); aList.add(tString.substring(i, Math.min(i + 64, j)));
} }
} }

View file

@ -22,7 +22,8 @@ public class Behaviour_Scanner
if (((aPlayer instanceof EntityPlayerMP)) && (aItem.canUse(aStack, 20000.0D))) { if (((aPlayer instanceof EntityPlayerMP)) && (aItem.canUse(aStack, 20000.0D))) {
ArrayList<String> tList = new ArrayList(); ArrayList<String> tList = new ArrayList();
if (aItem.use(aStack, GT_Utility.getCoordinateScan(tList, aPlayer, aWorld, 1, aX, aY, aZ, aSide, hitX, hitY, hitZ), aPlayer)) { 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)); GT_Utility.sendChatToPlayer(aPlayer, (String) tList.get(i));
} }
} }

View file

@ -161,7 +161,8 @@ public class GT_MetaTileEntity_DistillationTower
return false; return false;
} }
GT_MetaTileEntity_Hatch_Output[] tmpHatches = new GT_MetaTileEntity_Hatch_Output[5]; 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; int hatchNumber = this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() - 1 - height;
if (tmpHatches[hatchNumber] == null) { if (tmpHatches[hatchNumber] == null) {
tmpHatches[hatchNumber] = this.mOutputHatches.get(i); tmpHatches[hatchNumber] = this.mOutputHatches.get(i);

View file

@ -1,8 +1,5 @@
package gregtech.common.tileentities.machines.multi; package gregtech.common.tileentities.machines.multi;
import java.util.ArrayList;
import java.util.Arrays;
import gregtech.api.GregTech_API; import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures; import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine; 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.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
import java.util.Arrays;
public class GT_MetaTileEntity_ElectricBlastFurnace public class GT_MetaTileEntity_ElectricBlastFurnace
extends GT_MetaTileEntity_MultiBlockBase { extends GT_MetaTileEntity_MultiBlockBase {
private int mHeatingCapacity = 0; private int mHeatingCapacity = 0;
@ -72,13 +72,14 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
public boolean checkRecipe(ItemStack aStack) { public boolean checkRecipe(ItemStack aStack) {
ArrayList<ItemStack> tInputList = getStoredInputs(); ArrayList<ItemStack> tInputList = getStoredInputs();
for (int i = 0; i < tInputList.size() - 1; i++) { int tInputList_sS=tInputList.size();
for (int j = i + 1; j < tInputList.size(); j++) { 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 (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) {
if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) {
tInputList.remove(j--); tInputList.remove(j--); tInputList_sS=tInputList.size();
} else { } else {
tInputList.remove(i--); tInputList.remove(i--); tInputList_sS=tInputList.size();
break; break;
} }
} }
@ -87,13 +88,14 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2);
ArrayList<FluidStack> tFluidList = getStoredFluids(); ArrayList<FluidStack> tFluidList = getStoredFluids();
for (int i = 0; i < tFluidList.size() - 1; i++) { int tFluidList_sS=tFluidList.size();
for (int j = i + 1; j < tFluidList.size(); j++) { 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 (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) {
if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) {
tFluidList.remove(j--); tFluidList.remove(j--); tFluidList_sS=tFluidList.size();
} else { } else {
tFluidList.remove(i--); tFluidList.remove(i--); tFluidList_sS=tFluidList.size();
break; break;
} }
} }

View file

@ -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)) && (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)) { && (this.mEnergyHatches.size() >= 1) && (this.mOutputHatches.size() >= 1) && (this.mInputHatches.size() >= 2)) {
if (this.mEnergyHatches != null) { 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()) if (this.mEnergyHatches.get(i).mTier < tier())
return false; return false;
} }
} }
if (this.mOutputHatches != null) { 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()) if (this.mOutputHatches.get(i).mTier < tier())
return false; return false;
} }
} }
if (this.mInputHatches != null) { 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()) if (this.mInputHatches.get(i).mTier < tier())
return false; return false;
} }
@ -134,7 +137,8 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity
private boolean checkTier(byte tier, ArrayList<GT_MetaTileEntity_Hatch> list) { private boolean checkTier(byte tier, ArrayList<GT_MetaTileEntity_Hatch> list) {
if (list != null) { 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) { if (list.get(i).mTier < tier) {
return false; return false;
} }
@ -250,13 +254,14 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity
@Override @Override
public boolean checkRecipe(ItemStack aStack) { public boolean checkRecipe(ItemStack aStack) {
ArrayList<FluidStack> tFluidList = getStoredFluids(); ArrayList<FluidStack> tFluidList = getStoredFluids();
for (int i = 0; i < tFluidList.size() - 1; i++) { int tFluidList_sS=tFluidList.size();
for (int j = i + 1; j < tFluidList.size(); j++) { 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 (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) {
if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) {
tFluidList.remove(j--); tFluidList.remove(j--); tFluidList_sS=tFluidList.size();
} else { } else {
tFluidList.remove(i--); tFluidList.remove(i--); tFluidList_sS=tFluidList.size();
break; break;
} }
} }

View file

@ -69,13 +69,14 @@ public class GT_MetaTileEntity_ImplosionCompressor
public boolean checkRecipe(ItemStack aStack) { public boolean checkRecipe(ItemStack aStack) {
ArrayList<ItemStack> tInputList = getStoredInputs(); ArrayList<ItemStack> tInputList = getStoredInputs();
for (int i = 0; i < tInputList.size() - 1; i++) { int tInputList_sS=tInputList.size();
for (int j = i + 1; j < tInputList.size(); j++) { 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 (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) {
if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) {
tInputList.remove(j--); tInputList.remove(j--); tInputList_sS=tInputList.size();
} else { } else {
tInputList.remove(i--); tInputList.remove(i--); tInputList_sS=tInputList.size();
break; break;
} }
} }

View file

@ -95,7 +95,8 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT
int flow = 0; int flow = 0;
int totalFlow = 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)) { if (aFluids.get(i).isFluidEqual(firstFuelType)) {
flow = aFluids.get(i).amount; // Get all (steam) in hatch 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 flow = Math.min(flow, Math.min(remainingFlow, (int) (actualOptimalFlow * 1.25f))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow

View file

@ -99,7 +99,8 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar
int flow = 0; int flow = 0;
int totalFlow = 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)) { if (aFluids.get(i).isFluidEqual(firstFuelType)) {
flow = aFluids.get(i).amount; // Get all (steam) in hatch 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 flow = Math.min(flow, Math.min(remainingFlow, (int) (actualOptimalFlow * 1.25f))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow

View file

@ -1,9 +1,5 @@
package gregtech.loaders.misc; 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.FMLCommonHandler;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@ -33,6 +29,10 @@ import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import thaumcraft.api.ThaumcraftApiHelper; import thaumcraft.api.ThaumcraftApiHelper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class GT_Achievements { public class GT_Achievements {
public static List<Materials> oreList = new ArrayList<Materials>(); public static List<Materials> oreList = new ArrayList<Materials>();
@ -46,7 +46,8 @@ public class GT_Achievements {
public GT_Achievements() { public GT_Achievements() {
this.achievementList = new HashMap(); this.achievementList = new HashMap();
this.issuedAchievements = 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) { 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"); 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 } else if (data.mPrefix == OrePrefixes.ore || data.mPrefix == OrePrefixes.oreBlackgranite || data.mPrefix == OrePrefixes.oreEndstone
|| data.mPrefix == OrePrefixes.oreNetherrack || data.mPrefix == OrePrefixes.oreRedgranite) { || 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()); issueAchievement(player, data.getAllMaterialStacks().get(i).mMaterial.name());
if (data.getAllMaterialStacks().get(i).mMaterial == Materials.AnyIron) { if (data.getAllMaterialStacks().get(i).mMaterial == Materials.AnyIron) {
issueAchievement(player, "iron"); issueAchievement(player, "iron");

View file

@ -88,7 +88,8 @@ public class ProcessingDust implements gregtech.api.interfaces.IOreRecipeRegistr
tItemAmount = (tItemAmount * tDensityMultiplier % aMaterial.getDensity() > 0L ? 1 : 0) + tItemAmount * tDensityMultiplier / aMaterial.getDensity(); tItemAmount = (tItemAmount * tDensityMultiplier % aMaterial.getDensity() > 0L ? 1 : 0) + tItemAmount * tDensityMultiplier / aMaterial.getDensity();
if (tList.size() > 0) { if (tList.size() > 0) {
FluidStack tFluid = null; 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)) { 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; tFluid.amount *= ((ItemStack) tList.get(i)).stackSize;
tCapsuleCount -= GT_ModHandler.getCapsuleCellContainerCountMultipliedWithStackSize(new ItemStack[]{(ItemStack) tList.get(i)}); tCapsuleCount -= GT_ModHandler.getCapsuleCellContainerCountMultipliedWithStackSize(new ItemStack[]{(ItemStack) tList.get(i)});