Replaced normal for loops with foreach loops which is less error prone when just iterating over collection/array
This commit is contained in:
@@ -575,10 +575,8 @@ public class Platform
|
||||
CraftingManager cm = CraftingManager.getInstance();
|
||||
List<IRecipe> rl = cm.getRecipeList();
|
||||
|
||||
for (int x = 0; x < rl.size(); ++x)
|
||||
for (IRecipe r : rl)
|
||||
{
|
||||
IRecipe r = rl.get( x );
|
||||
|
||||
if ( r.matches( par1InventoryCrafting, par2World ) )
|
||||
{
|
||||
return r;
|
||||
|
||||
@@ -89,10 +89,13 @@ public class AdaptorISpecialInventory extends InventoryAdaptor
|
||||
if ( slots == null )
|
||||
return false;
|
||||
|
||||
int s = slots.length;
|
||||
for (int x = 0; x < s; x++)
|
||||
if ( i.getStackInSlot( slots[x] ) != null )
|
||||
for (int slot : slots)
|
||||
{
|
||||
if ( i.getStackInSlot( slot ) != null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -52,16 +52,18 @@ public class AdaptorList extends InventoryAdaptor
|
||||
@Override
|
||||
public ItemStack simulateSimilarRemove(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination dest)
|
||||
{
|
||||
int s = i.size();
|
||||
for (int x = 0; x < s; x++)
|
||||
for (ItemStack is : i)
|
||||
{
|
||||
ItemStack is = i.get( x );
|
||||
if ( is != null && (filter == null || Platform.isSameItemFuzzy( is, filter, fuzzyMode )) )
|
||||
{
|
||||
if ( how_many > is.stackSize )
|
||||
{
|
||||
how_many = is.stackSize;
|
||||
}
|
||||
if ( dest != null && !dest.canInsert( is ) )
|
||||
{
|
||||
how_many = 0;
|
||||
}
|
||||
|
||||
if ( how_many > 0 )
|
||||
{
|
||||
@@ -109,16 +111,18 @@ public class AdaptorList extends InventoryAdaptor
|
||||
@Override
|
||||
public ItemStack simulateRemove(int how_many, ItemStack filter, IInventoryDestination dest)
|
||||
{
|
||||
int s = i.size();
|
||||
for (int x = 0; x < s; x++)
|
||||
for (ItemStack is : i)
|
||||
{
|
||||
ItemStack is = i.get( x );
|
||||
if ( is != null && (filter == null || Platform.isSameItemPrecise( is, filter )) )
|
||||
{
|
||||
if ( how_many > is.stackSize )
|
||||
{
|
||||
how_many = is.stackSize;
|
||||
}
|
||||
if ( dest != null && !dest.canInsert( is ) )
|
||||
{
|
||||
how_many = 0;
|
||||
}
|
||||
|
||||
if ( how_many > 0 )
|
||||
{
|
||||
@@ -142,10 +146,8 @@ public class AdaptorList extends InventoryAdaptor
|
||||
|
||||
ItemStack left = A.copy();
|
||||
|
||||
int s = i.size();
|
||||
for (int x = 0; x < s; x++)
|
||||
for (ItemStack is : i)
|
||||
{
|
||||
ItemStack is = i.get( x );
|
||||
if ( Platform.isSameItem( is, left ) )
|
||||
{
|
||||
is.stackSize += left.stackSize;
|
||||
@@ -166,13 +168,12 @@ public class AdaptorList extends InventoryAdaptor
|
||||
@Override
|
||||
public boolean containsItems()
|
||||
{
|
||||
|
||||
int s = i.size();
|
||||
for (int x = 0; x < s; x++)
|
||||
for (ItemStack is : i)
|
||||
{
|
||||
ItemStack is = i.get( x );
|
||||
if ( is != null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -16,11 +16,13 @@ public class WrapperInventoryRange implements IInventory
|
||||
if ( s.length > 0 )
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < s.length; i++)
|
||||
for (int value : s)
|
||||
{
|
||||
if ( sb.length() > 0 )
|
||||
{
|
||||
sb.append( separator );
|
||||
sb.append( s[i] );
|
||||
}
|
||||
sb.append( value );
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user