Fixes #1850: Fixed support for second optional output of the AE2 Grindstone

This commit is contained in:
thatsIch
2015-09-01 23:58:40 +02:00
parent 468cb4e9df
commit 0d312f91af
4 changed files with 24 additions and 9 deletions
@@ -117,7 +117,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
}
this.log( "Allow Grinding of " + Platform.getItemDisplayName( in ) + " to " + Platform.getItemDisplayName( out ) + " with optional " + Platform.getItemDisplayName( optional ) + " for " + cost );
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), chance, cost ) );
this.injectRecipe( new AppEngGrinderRecipe( this.copy( in ), this.copy( out ), this.copy( optional ), this.copy( optional2 ), chance, chance2, cost ) );
}
private void injectRecipe( AppEngGrinderRecipe appEngGrinderRecipe )
@@ -55,9 +55,13 @@ public enum GuiText
inWorldFluix, inWorldPurificationCertus, inWorldPurificationNether,
inWorldPurificationFluix, inWorldSingularity, ChargedQuartz, OfSecondOutput,
inWorldPurificationFluix, inWorldSingularity, ChargedQuartz,
NoSecondOutput, Stores, Next, SelectAmount, Lumen, Empty,
NoSecondOutput,
OfSecondOutput,
MultipleOutputs,
Stores, Next, SelectAmount, Lumen, Empty,
ConfirmCrafting, Stored, Crafting, Scheduled, CraftingStatus, Cancel, ETA, ETAFormat,
@@ -109,6 +109,7 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
public String getGuiTexture()
{
ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/guis/grinder.png" );
return loc.toString();
}
@@ -194,13 +195,22 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
this.result = new PositionedStack( recipe.getOutput(), -30 + 107, 47 );
this.ingredients = new ArrayList<PositionedStack>();
if( recipe.getOptionalOutput() != null )
final ItemStack optionalOutput = recipe.getOptionalOutput();
final int optionalChancePercent = (int) ( recipe.getOptionalChance() * 100 );
if( optionalOutput != null )
{
final int chancePercent = (int) (recipe.getOptionalChance() * 100);
this.hasOptional = true;
this.displayChance = String.format( GuiText.OfSecondOutput.getLocal(), chancePercent );
this.ingredients.add( new PositionedStack( recipe.getOptionalOutput(), -30 + 107 + 18, 47 ) );
this.displayChance = String.format( GuiText.OfSecondOutput.getLocal(), optionalChancePercent );
this.ingredients.add( new PositionedStack( optionalOutput, -30 + 107 + 18, 47 ) );
}
final ItemStack secondOptionalOutput = recipe.getSecondOptionalOutput();
final int secondOptionalChancePercent = (int) ( recipe.getSecondOptionalChance() * 100 );
if( secondOptionalOutput != null )
{
this.hasOptional = true;
this.displayChance = String.format( GuiText.MultipleOutputs.getLocal(), optionalChancePercent, secondOptionalChancePercent );
this.ingredients.add( new PositionedStack( secondOptionalOutput, -30 + 107 + 18 + 18, 47 ) );
}
if( recipe.getInput() != null )