Replaced normal for loops with foreach loops which is less error prone when just iterating over collection/array
This commit is contained in:
@@ -35,9 +35,13 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
|
||||
cols = input.get( 0 ).size();
|
||||
if ( cols <= 3 && cols >= 1 )
|
||||
{
|
||||
for (int x = 0; x < input.size(); x++)
|
||||
if ( input.get( x ).size() != cols )
|
||||
for (List<IIngredient> anInput : input)
|
||||
{
|
||||
if ( anInput.size() != cols )
|
||||
{
|
||||
throw new RecipeError( "all rows in a shaped crafting recipe must contain the same number of ingredients." );
|
||||
}
|
||||
}
|
||||
|
||||
inputs = input;
|
||||
this.output = output.get( 0 ).get( 0 );
|
||||
|
||||
@@ -61,18 +61,19 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
|
||||
@Override
|
||||
public boolean canCraft(ItemStack reqOutput) throws RegistrationError, MissingIngredientError {
|
||||
|
||||
for ( int y = 0; y < inputs.size(); y++ )
|
||||
for (IIngredient i : inputs)
|
||||
{
|
||||
IIngredient i = inputs.get(y);
|
||||
if ( !i.isAir() )
|
||||
if ( !i.isAir() )
|
||||
{
|
||||
for (ItemStack r : i.getItemStackSet())
|
||||
{
|
||||
for ( ItemStack r : i.getItemStackSet() )
|
||||
if ( Platform.isSameItemPrecise( r, reqOutput ) )
|
||||
{
|
||||
if ( Platform.isSameItemPrecise( r, reqOutput) )
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Platform.isSameItemPrecise( output.getItemStack(),reqOutput );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user