Merge pull request #216 from thatsIch/stringbuilder

Use StringBuilder to its fullest
This commit is contained in:
FireBall1725 2014-10-02 09:00:10 -04:00
commit 40206a8d3f
3 changed files with 20 additions and 6 deletions

View file

@ -79,7 +79,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
StringBuilder ret = new StringBuilder( "Invalid shaped ore recipe: " );
for (Object tmp : recipe)
{
ret.append( tmp + ", " );
ret.append( tmp ).append( ", " );
}
ret.append( output );
throw new RuntimeException( ret.toString() );
@ -101,7 +101,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
StringBuilder ret = new StringBuilder( "Invalid shaped ore recipe: " );
for (Object tmp : recipe)
{
ret.append( tmp + ", " );
ret.append( tmp ).append( ", " );
}
ret.append( output );
throw new RuntimeException( ret.toString() );

View file

@ -37,7 +37,7 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
StringBuilder ret = new StringBuilder( "Invalid shapeless ore recipe: " );
for (Object tmp : recipe)
{
ret.append( tmp + ", " );
ret.append( tmp ).append( ", " );
}
ret.append( output );
throw new RuntimeException( ret.toString() );

View file

@ -84,15 +84,29 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
{
StringBuilder o = new StringBuilder( "shapeless " + output.getQty() + "\n" );
o.append( h.getName( output ) + "\n" );
o.append( h.getName( output ) ).append( "\n" );
for (int y = 0; y < inputs.size(); y++)
{
IIngredient i = inputs.get( y );
if ( i.isAir() )
o.append( "air" + (y + 1 == inputs.size() ? "\n" : " ") );
{
o.append( "air" );
}
else
o.append( h.getName( i ) + (y + 1 == inputs.size() ? "\n" : " ") );
{
o.append( h.getName( i ) );
}
if ( y + 1 == this.inputs.size() )
{
o.append( "\n" );
}
else
{
o.append( " " );
}
}
return o.toString().trim();