diff --git a/src/main/java/codechicken/nei/recipe/chain/RecipeChainTooltipLineHandler.java b/src/main/java/codechicken/nei/recipe/chain/RecipeChainTooltipLineHandler.java index 6d33dc3b7..1f2f4af37 100644 --- a/src/main/java/codechicken/nei/recipe/chain/RecipeChainTooltipLineHandler.java +++ b/src/main/java/codechicken/nei/recipe/chain/RecipeChainTooltipLineHandler.java @@ -36,6 +36,7 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler { protected ItemsTooltipLineHandler inputs; protected ItemsTooltipLineHandler outputs; protected ItemsTooltipLineHandler remainder; + protected ItemsTooltipLineHandler craftingNeeded; protected boolean lastShiftKey = false; protected boolean lastControlKey = false; @@ -54,6 +55,7 @@ private void onUpdate() { final List inputs = new ArrayList<>(); final List outputs = new ArrayList<>(); final List remainder = new ArrayList<>(); + final List craftingNeeded = new ArrayList<>(); final ItemStackAmount inventory = new ItemStackAmount(); final GuiContainer currentGui = NEIClientUtils.getGuiContainer(); @@ -167,6 +169,12 @@ private void onUpdate() { } } + if (this.lastShiftKey) { + for (Map.Entry item : this.math.requiredAmount.entrySet()) { + if (item.getKey().type == BookmarkItem.BookmarkItemType.RESULT && item.getValue() != 0) + craftingNeeded.add(item.getKey().getItemStack(item.getValue())); + } + } inputs.sort( Comparator.comparing((ItemStack stack) -> StackInfo.getFluid(stack) != null) @@ -203,9 +211,16 @@ private void onUpdate() { true, Integer.MAX_VALUE); + this.craftingNeeded = new ItemsTooltipLineHandler( + NEIClientUtils.translate("bookmark.crafting_chain.needed"), + craftingNeeded, + true, + Integer.MAX_VALUE); + if (this.lastShiftKey) { this.inputs.setLabelColor(EnumChatFormatting.RED); this.available.setLabelColor(EnumChatFormatting.GREEN); + this.craftingNeeded.setLabelColor(EnumChatFormatting.BLUE); } this.size.height = this.size.width = 0; @@ -217,16 +232,18 @@ private void onUpdate() { if (!this.math.outputRecipes.isEmpty()) { this.size.height = 2 + GuiDraw.fontRenderer.FONT_HEIGHT; } - this.size.width = Math.max( this.inputs.getSize().width, Math.max( this.outputs.getSize().width, - Math.max(this.remainder.getSize().width, this.available.getSize().width))); + Math.max( + this.remainder.getSize().width, + Math.max(this.available.getSize().width, this.craftingNeeded.getSize().width)))); this.size.height += this.inputs.getSize().height + this.outputs.getSize().height + this.remainder.getSize().height - + this.available.getSize().height; + + this.available.getSize().height + + this.craftingNeeded.getSize().height; } } @@ -258,7 +275,6 @@ public void draw(int x, int y) { } if (NEIClientConfig.recipeChainDir() == 0) { - if (!this.inputs.isEmpty()) { this.inputs.draw(x, y); y += this.inputs.getSize().height; @@ -269,6 +285,11 @@ public void draw(int x, int y) { y += this.available.getSize().height; } + if (!this.craftingNeeded.isEmpty()) { + this.craftingNeeded.draw(x, y); + y += this.craftingNeeded.getSize().height; + } + if (!this.outputs.isEmpty()) { this.outputs.draw(x, y); y += this.outputs.getSize().height; @@ -286,6 +307,11 @@ public void draw(int x, int y) { y += this.inputs.getSize().height; } + if (!this.craftingNeeded.isEmpty()) { + this.craftingNeeded.draw(x, y); + y += this.craftingNeeded.getSize().height; + } + if (!this.available.isEmpty()) { this.available.draw(x, y); y += this.available.getSize().height; diff --git a/src/main/resources/assets/nei/lang/en_US.lang b/src/main/resources/assets/nei/lang/en_US.lang index 64d189d4c..7d659aeb4 100644 --- a/src/main/resources/assets/nei/lang/en_US.lang +++ b/src/main/resources/assets/nei/lang/en_US.lang @@ -47,6 +47,7 @@ nei.bookmark.crafting_chain.input=Ingredients nei.bookmark.crafting_chain.missing=Missing Items nei.bookmark.crafting_chain.output=Results nei.bookmark.crafting_chain.remainder=Remainders +nei.bookmark.crafting_chain.needed=Required Crafts nei.bookmark.crafting_chain.available=Available Items nei.inventory.search.placeholder=Search... nei.itempanel.quantity.default=One stack