From 0d312f91afec72374da2a90c85e6d4087c973b32 Mon Sep 17 00:00:00 2001 From: thatsIch Date: Tue, 1 Sep 2015 23:58:40 +0200 Subject: [PATCH] Fixes #1850: Fixed support for second optional output of the AE2 Grindstone --- .../registries/GrinderRecipeManager.java | 2 +- .../appeng/core/localization/GuiText.java | 8 ++++++-- .../NEIHelpers/NEIGrinderRecipeHandler.java | 20 ++++++++++++++----- .../appliedenergistics2/lang/en_US.lang | 3 ++- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/main/java/appeng/core/features/registries/GrinderRecipeManager.java b/src/main/java/appeng/core/features/registries/GrinderRecipeManager.java index 90230be6..addb24ba 100644 --- a/src/main/java/appeng/core/features/registries/GrinderRecipeManager.java +++ b/src/main/java/appeng/core/features/registries/GrinderRecipeManager.java @@ -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 ) diff --git a/src/main/java/appeng/core/localization/GuiText.java b/src/main/java/appeng/core/localization/GuiText.java index 48bd72b3..6000d8ad 100644 --- a/src/main/java/appeng/core/localization/GuiText.java +++ b/src/main/java/appeng/core/localization/GuiText.java @@ -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, diff --git a/src/main/java/appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java b/src/main/java/appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java index a3acc12d..6d0cce64 100644 --- a/src/main/java/appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java +++ b/src/main/java/appeng/integration/modules/NEIHelpers/NEIGrinderRecipeHandler.java @@ -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(); - 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 ) diff --git a/src/main/resources/assets/appliedenergistics2/lang/en_US.lang b/src/main/resources/assets/appliedenergistics2/lang/en_US.lang index c80073b6..e0c8b5d4 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/en_US.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/en_US.lang @@ -185,8 +185,9 @@ gui.appliedenergistics2.inWorldPurificationFluix=Drop a Fluix Seed made from Flu gui.appliedenergistics2.inWorldSingularity=To create drop 1 Singularity and 1 Ender Dust and cause an explosion within range of the items. gui.appliedenergistics2.ChargedQuartz=Charged Certus Quartz is crafted by inserting an uncharged Certus Quartz Crystal into the Charger, and powering it. gui.appliedenergistics2.ChargedQuartzFind=Charged Certus Quartz can be found in world semi rarely, it appears similar to normal Certus Quartz, except it sparkles. -gui.appliedenergistics2.OfSecondOutput=%1$d%% Chance for second output. gui.appliedenergistics2.NoSecondOutput=No Secondary Output +gui.appliedenergistics2.OfSecondOutput=%1$d%% Chance for second output. +gui.appliedenergistics2.MultipleOutputs=%1$d%% second, %2$d%% third output. gui.appliedenergistics2.SelectAmount=Select Amount gui.appliedenergistics2.CopyMode=Copy Mode gui.appliedenergistics2.CopyModeDesc=Controls if the contents of the configuration pane are cleared when you remove the cell.