From 1e2801c8916f080713d71c56c5d81bbda15d3ca8 Mon Sep 17 00:00:00 2001 From: micvog <41322907+micvog@users.noreply.github.com> Date: Tue, 6 Oct 2026 18:46:37 +0200 Subject: [PATCH 1/4] Fix crash when returning to the crafting tree after its bookmark group was removed (#1063) --- .../codechicken/nei/bookmark/tree/GuiCraftingTree.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/codechicken/nei/bookmark/tree/GuiCraftingTree.java b/src/main/java/codechicken/nei/bookmark/tree/GuiCraftingTree.java index 01d05aea..229d1e37 100644 --- a/src/main/java/codechicken/nei/bookmark/tree/GuiCraftingTree.java +++ b/src/main/java/codechicken/nei/bookmark/tree/GuiCraftingTree.java @@ -190,6 +190,13 @@ public class GuiCraftingTree extends GuiContainer implements INEIGuiHandler, IGu @Override public void initGui() { + + // the group can be removed from the bookmark panel while a recipe screen opened from this tree is shown + if (this.grid.getGroup(this.groupId) == null) { + this.mc.displayGuiScreen(this.prevGui); + return; + } + this.xSize = this.width; this.ySize = this.height; From 35f5400ecbf802bf9bdcd602c9b04c9d7d2614ff Mon Sep 17 00:00:00 2001 From: slprime <31038811+slprime@users.noreply.github.com> Date: Tue, 6 Oct 2026 19:57:10 +0300 Subject: [PATCH 2/4] Fix Crafting Tree NPE (#1064) --- src/main/java/codechicken/nei/bookmark/BookmarkStorage.java | 5 +++++ .../java/codechicken/nei/bookmark/tree/GuiCraftingTree.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/codechicken/nei/bookmark/BookmarkStorage.java b/src/main/java/codechicken/nei/bookmark/BookmarkStorage.java index 23e9e987..95aa9d4f 100644 --- a/src/main/java/codechicken/nei/bookmark/BookmarkStorage.java +++ b/src/main/java/codechicken/nei/bookmark/BookmarkStorage.java @@ -198,6 +198,11 @@ public class BookmarkStorage { final BookmarkItem item = BookmarkItem.of(parser.parse(itemStr).getAsJsonObject()); if (item != null) { + + if (!grid.groups.containsKey(item.groupId)) { + item.groupId = BookmarkGrid.DEFAULT_GROUP_ID; + } + grid.addItem(item, false); } else { wasError = true; diff --git a/src/main/java/codechicken/nei/bookmark/tree/GuiCraftingTree.java b/src/main/java/codechicken/nei/bookmark/tree/GuiCraftingTree.java index 229d1e37..14836079 100644 --- a/src/main/java/codechicken/nei/bookmark/tree/GuiCraftingTree.java +++ b/src/main/java/codechicken/nei/bookmark/tree/GuiCraftingTree.java @@ -162,7 +162,7 @@ public class GuiCraftingTree extends GuiContainer implements INEIGuiHandler, IGu final ItemTreeSlot replaceNode = this.uiState.replaceRecipeNode; this.uiState.replaceRecipeNode = null; - if (recipe != null) { + if (recipe != null && this.grid.getGroup(this.groupId) != null) { final RecipeId recipeId = recipe.getRecipeId(); boolean changed = false; From 869b4571b0c1f5677319c5adea10351883c6b85a Mon Sep 17 00:00:00 2001 From: slprime <31038811+slprime@users.noreply.github.com> Date: Fri, 9 Oct 2026 19:47:38 +0300 Subject: [PATCH 3/4] Add recipe cycle freeze option (#1067) --- src/main/java/codechicken/nei/NEIClientConfig.java | 9 +++++++++ .../java/codechicken/nei/recipe/widget/RecipeWidget.java | 3 ++- src/main/resources/assets/nei/lang/en_US.lang | 3 +++ src/main/resources/assets/nei/lang/ru_RU.lang | 3 +++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/codechicken/nei/NEIClientConfig.java b/src/main/java/codechicken/nei/NEIClientConfig.java index 13a0fceb..1d48960c 100644 --- a/src/main/java/codechicken/nei/NEIClientConfig.java +++ b/src/main/java/codechicken/nei/NEIClientConfig.java @@ -267,6 +267,11 @@ public class NEIClientConfig { .getBooleanValue(true); API.addOption(new OptionToggleButton("inventory.guirecipe.scrollPages", true)); + tag.getTag("inventory.guirecipe.freezeCycleOnHover") + .setComment("Stop cycling the recipe while hovering over an ingredient or a button") + .getBooleanValue(false); + API.addOption(new OptionToggleButton("inventory.guirecipe.freezeCycleOnHover", true)); + tag.getTag("inventory.guirecipe.profile").getBooleanValue(false); API.addOption(new OptionToggleButton("inventory.guirecipe.profile", true)); @@ -1166,6 +1171,10 @@ public class NEIClientConfig { return getBooleanSetting("inventory.guirecipe.cycledIngredientsTooltip"); } + public static boolean freezeCycleOnHover() { + return getBooleanSetting("inventory.guirecipe.freezeCycleOnHover"); + } + public static boolean requireShiftForOverlayRecipe() { return getBooleanSetting("inventory.guirecipe.shiftOverlayRecipe"); } diff --git a/src/main/java/codechicken/nei/recipe/widget/RecipeWidget.java b/src/main/java/codechicken/nei/recipe/widget/RecipeWidget.java index aaac733c..f585c6b8 100644 --- a/src/main/java/codechicken/nei/recipe/widget/RecipeWidget.java +++ b/src/main/java/codechicken/nei/recipe/widget/RecipeWidget.java @@ -745,7 +745,8 @@ public class RecipeWidget extends Widget { return true; } - return !this.showAsWidget && contains(mouseX, mouseY) + return NEIClientConfig.freezeCycleOnHover() && !this.showAsWidget + && contains(mouseX, mouseY) && (getPositionedStackMouseOver(mouseX, mouseY) != null || forEachButtons(button -> button.contains(mouseX, mouseY) ? true : null, false)); } diff --git a/src/main/resources/assets/nei/lang/en_US.lang b/src/main/resources/assets/nei/lang/en_US.lang index d9a176c6..6c402737 100644 --- a/src/main/resources/assets/nei/lang/en_US.lang +++ b/src/main/resources/assets/nei/lang/en_US.lang @@ -427,6 +427,9 @@ nei.options.inventory.autocrafting.false=Disabled nei.options.inventory.guirecipe.shiftOverlayRecipe=Require holding shift to move items when overlaying recipe nei.options.inventory.guirecipe.shiftOverlayRecipe.true=Yes nei.options.inventory.guirecipe.shiftOverlayRecipe.false=No +nei.options.inventory.guirecipe.freezeCycleOnHover=Stop cycling the recipe while hovering over an ingredient or a button +nei.options.inventory.guirecipe.freezeCycleOnHover.true=Yes +nei.options.inventory.guirecipe.freezeCycleOnHover.false=No nei.options.inventory.widgetsenabled.true=NEI Enabled nei.options.inventory.widgetsenabled.false=NEI Disabled nei.options.inventory.cheatmode.0=Recipe Mode diff --git a/src/main/resources/assets/nei/lang/ru_RU.lang b/src/main/resources/assets/nei/lang/ru_RU.lang index 076ec044..6e2add71 100644 --- a/src/main/resources/assets/nei/lang/ru_RU.lang +++ b/src/main/resources/assets/nei/lang/ru_RU.lang @@ -265,6 +265,9 @@ nei.options.inventory.optimize_gui_overlap_computation.false=Нет nei.options.inventory.guirecipe.shiftOverlayRecipe=Требовать удержание Shift для перемещения предметов при отображении рецепта nei.options.inventory.guirecipe.shiftOverlayRecipe.true=Да nei.options.inventory.guirecipe.shiftOverlayRecipe.false=Нет +nei.options.inventory.guirecipe.freezeCycleOnHover=Останавливать перелистывание рецепта при наведении на предмет или кнопку +nei.options.inventory.guirecipe.freezeCycleOnHover.true=Да +nei.options.inventory.guirecipe.freezeCycleOnHover.false=Нет nei.options.inventory.widgetsenabled.true=NEI включен nei.options.inventory.widgetsenabled.false=NEI выключен nei.options.inventory.cheatmode.0=Режим рецептов From e6174c446a8da7dfa406d453b0edd79be34ad3eb Mon Sep 17 00:00:00 2001 From: slprime <31038811+slprime@users.noreply.github.com> Date: Fri, 9 Oct 2026 21:14:11 +0300 Subject: [PATCH 4/4] Add options for vertical line count in chain tooltips (#1068) --- .../nei/ItemsTooltipLineHandler.java | 22 ++++++++----------- .../java/codechicken/nei/NEIClientConfig.java | 9 ++++++++ .../nei/recipe/GuiOverlayButton.java | 2 +- .../recipe/RecipeItemsTooltipLineHandler.java | 16 +++++++++----- .../chain/RecipeChainTooltipLineHandler.java | 5 +++-- src/main/resources/assets/nei/lang/en_US.lang | 1 + 6 files changed, 33 insertions(+), 22 deletions(-) diff --git a/src/main/java/codechicken/nei/ItemsTooltipLineHandler.java b/src/main/java/codechicken/nei/ItemsTooltipLineHandler.java index 9b6575ab..c326b207 100644 --- a/src/main/java/codechicken/nei/ItemsTooltipLineHandler.java +++ b/src/main/java/codechicken/nei/ItemsTooltipLineHandler.java @@ -167,7 +167,7 @@ public class ItemsTooltipLineHandler implements ITooltipLineHandler { protected int activeStackIndex = -1; protected Dimension size = new Dimension(); - protected final boolean showNames; + protected int maxNamedRows = Integer.MAX_VALUE; protected int length = 0; protected int rows = 0; @@ -175,29 +175,25 @@ public class ItemsTooltipLineHandler implements ITooltipLineHandler { protected int gridColumns = 0; protected int gridCount = 0; - public static ItemsTooltipLineHandler grid(String label, List items, int maxRows) { - return new ItemsTooltipLineHandler(label, items, true, maxRows, false); - } - - public static ItemsTooltipLineHandler list(String label, List items, int maxRows) { - return new ItemsTooltipLineHandler(label, items, true, maxRows, true); + public static ItemsTooltipLineHandler of(String label, List items, int maxRows, int maxNamedRows) { + return new ItemsTooltipLineHandler(label, items, true, maxRows, maxNamedRows); } public ItemsTooltipLineHandler(String label, List items) { - this(label, items, true, DEFAULT_MAX_ROWS, false); + this(label, items, true, DEFAULT_MAX_ROWS, 0); } public ItemsTooltipLineHandler(String label, List items, boolean saveStackSize, int maxRows) { - this(label, items, saveStackSize, maxRows, false); + this(label, items, saveStackSize, maxRows, 0); } protected ItemsTooltipLineHandler(String label, List items, boolean saveStackSize, int maxRows, - boolean showNames) { + int maxNamedRows) { this.label = label; this.items = groupingItemStacks(items); this.amountRenderer = saveStackSize ? new TotalAmountRenderer() : new NoAmountRenderer(); this.length = this.items.size(); - this.showNames = showNames; + this.maxNamedRows = maxNamedRows; setMaxRows(maxRows); } @@ -214,7 +210,7 @@ public class ItemsTooltipLineHandler implements ITooltipLineHandler { this.names.clear(); this.nameRows = 0; - if (!this.showNames || !layoutWithNames(maxRows)) { + if (!layoutWithNames(maxRows)) { layoutAsGrid(maxRows); } @@ -228,7 +224,7 @@ public class ItemsTooltipLineHandler implements ITooltipLineHandler { } protected boolean layoutWithNames(int maxRows) { - final int maxNames = this.length <= maxRows ? this.length : maxRows - 1; + final int maxNames = Math.min(this.maxNamedRows, this.length <= maxRows ? this.length : maxRows - 1); final int[] lineWidth = new int[maxNames + 1]; lineWidth[0] = labelWidth(); diff --git a/src/main/java/codechicken/nei/NEIClientConfig.java b/src/main/java/codechicken/nei/NEIClientConfig.java index 1d48960c..732e5bac 100644 --- a/src/main/java/codechicken/nei/NEIClientConfig.java +++ b/src/main/java/codechicken/nei/NEIClientConfig.java @@ -200,6 +200,11 @@ public class NEIClientConfig { tag.getTag("inventory.bookmarks.showRecipeMarkerMode").setComment("Show Recipe Marker").getIntValue(0); API.addOption(new OptionCycled("inventory.bookmarks.showRecipeMarkerMode", 3, true)); + tag.getTag("inventory.bookmarks.maxVerticalTooltipRows") + .setComment("Max rows in vertical crafting chain tooltip lists (0 - disable, always use grid)") + .getIntValue(12); + API.addOption(new OptionIntegerField("inventory.bookmarks.maxVerticalTooltipRows", 0, 50)); + tag.getTag("inventory.bookmarks.recipeMarkerColor").setComment("Color of the icon marker") .getHexValue(0xADADAD); API.addOption( @@ -1111,6 +1116,10 @@ public class NEIClientConfig { return getIntSetting("inventory.bookmarks.showRecipeMarkerMode"); } + public static int getMaxVerticalTooltipRows() { + return getIntSetting("inventory.bookmarks.maxVerticalTooltipRows"); + } + public static boolean showItemQuantityWidget() { return getBooleanSetting("inventory.showItemQuantityWidget"); } diff --git a/src/main/java/codechicken/nei/recipe/GuiOverlayButton.java b/src/main/java/codechicken/nei/recipe/GuiOverlayButton.java index 922960df..a1ecb3af 100644 --- a/src/main/java/codechicken/nei/recipe/GuiOverlayButton.java +++ b/src/main/java/codechicken/nei/recipe/GuiOverlayButton.java @@ -263,7 +263,7 @@ public class GuiOverlayButton extends GuiRecipeButton { if (!items.isEmpty()) { this.missedMaterialsTooltipLineHandler = ItemsTooltipLineHandler - .grid(NEIClientUtils.translate("recipe.overlay.missing"), items, Integer.MAX_VALUE); + .of(NEIClientUtils.translate("recipe.overlay.missing"), items, Integer.MAX_VALUE, 0); } else { this.missedMaterialsTooltipLineHandler = null; } diff --git a/src/main/java/codechicken/nei/recipe/RecipeItemsTooltipLineHandler.java b/src/main/java/codechicken/nei/recipe/RecipeItemsTooltipLineHandler.java index 4fc1478c..00685f51 100644 --- a/src/main/java/codechicken/nei/recipe/RecipeItemsTooltipLineHandler.java +++ b/src/main/java/codechicken/nei/recipe/RecipeItemsTooltipLineHandler.java @@ -21,6 +21,7 @@ import codechicken.nei.ItemStackAmount; import codechicken.nei.ItemsTooltipLineHandler; import codechicken.nei.ItemsTooltipLineHandler.StacksAmountRenderer; import codechicken.nei.ItemsTooltipLineHandler.TotalAmountRenderer; +import codechicken.nei.NEIClientConfig; import codechicken.nei.NEIClientUtils; import codechicken.nei.PositionedStack; import codechicken.nei.api.IGuiContainerOverlay; @@ -163,9 +164,9 @@ public class RecipeItemsTooltipLineHandler extends CompositeTooltipLineHandler { protected void addResultLine(List items, Set approximate) { final String label = NEIClientUtils.translate("recipe.items.results"); - final ItemsTooltipLineHandler line = items.size() == 1 - ? ItemsTooltipLineHandler.list(label, items, maxLineRows()) - : ItemsTooltipLineHandler.grid(label, items, maxLineRows()); + final int maxRows = maxLineRows(); + final int maxNamedRows = items.size() == 1 ? NEIClientConfig.getMaxVerticalTooltipRows() : 0; + final ItemsTooltipLineHandler line = ItemsTooltipLineHandler.of(label, items, maxRows, maxNamedRows); if (line.isEmpty()) { return; @@ -188,7 +189,9 @@ public class RecipeItemsTooltipLineHandler extends CompositeTooltipLineHandler { protected void addRequiredLine(List items, Set approximate) { final String label = NEIClientUtils.translate("recipe.items.ingredients"); - final ItemsTooltipLineHandler line = ItemsTooltipLineHandler.list(label, items, maxLineRows()); + final int maxRows = maxLineRows(); + final int maxNamedRows = NEIClientConfig.getMaxVerticalTooltipRows(); + final ItemsTooltipLineHandler line = ItemsTooltipLineHandler.of(label, items, maxRows, maxNamedRows); if (line.isEmpty()) { return; @@ -211,8 +214,9 @@ public class RecipeItemsTooltipLineHandler extends CompositeTooltipLineHandler { protected void addNeededLine(List items, Set approximate, boolean vertical) { final String label = NEIClientUtils.translate("recipe.items.ingredients_needed"); - final ItemsTooltipLineHandler line = vertical ? ItemsTooltipLineHandler.list(label, items, maxLineRows()) - : ItemsTooltipLineHandler.grid(label, items, maxLineRows()); + final int maxRows = maxLineRows(); + final int maxNamedRows = vertical ? NEIClientConfig.getMaxVerticalTooltipRows() : 0; + final ItemsTooltipLineHandler line = ItemsTooltipLineHandler.of(label, items, maxRows, maxNamedRows); if (line.isEmpty()) { return; diff --git a/src/main/java/codechicken/nei/recipe/chain/RecipeChainTooltipLineHandler.java b/src/main/java/codechicken/nei/recipe/chain/RecipeChainTooltipLineHandler.java index 80d1dfd1..c09ea761 100644 --- a/src/main/java/codechicken/nei/recipe/chain/RecipeChainTooltipLineHandler.java +++ b/src/main/java/codechicken/nei/recipe/chain/RecipeChainTooltipLineHandler.java @@ -25,6 +25,7 @@ import codechicken.nei.ItemsTooltipLineHandler; import codechicken.nei.ItemsTooltipLineHandler.AmountRenderer; import codechicken.nei.ItemsTooltipLineHandler.StacksAmountRenderer; import codechicken.nei.ItemsTooltipLineHandler.TotalAmountRenderer; +import codechicken.nei.NEIClientConfig; import codechicken.nei.NEIClientUtils; import codechicken.nei.bookmark.BookmarkItem; import codechicken.nei.drawable.DrawableResource; @@ -354,8 +355,8 @@ public class RecipeChainTooltipLineHandler extends CompositeTooltipLineHandler { protected void addLine(String label, List items, boolean vertical, EnumChatFormatting labelColor, AmountRenderer amountRenderer) { - final ItemsTooltipLineHandler line = vertical ? ItemsTooltipLineHandler.list(label, items, maxLineRows()) - : ItemsTooltipLineHandler.grid(label, items, maxLineRows()); + final int maxNamedRows = vertical ? NEIClientConfig.getMaxVerticalTooltipRows() : 0; + final ItemsTooltipLineHandler line = ItemsTooltipLineHandler.of(label, items, maxLineRows(), maxNamedRows); if (line.isEmpty()) { return; diff --git a/src/main/resources/assets/nei/lang/en_US.lang b/src/main/resources/assets/nei/lang/en_US.lang index 6c402737..12ce30e9 100644 --- a/src/main/resources/assets/nei/lang/en_US.lang +++ b/src/main/resources/assets/nei/lang/en_US.lang @@ -289,6 +289,7 @@ nei.options.inventory.bookmarks.showRecipeMarkerMode=Show Recipe Marker nei.options.inventory.bookmarks.showRecipeMarkerMode.0=None nei.options.inventory.bookmarks.showRecipeMarkerMode.1=Text nei.options.inventory.bookmarks.showRecipeMarkerMode.2=Background +nei.options.inventory.bookmarks.maxVerticalTooltipRows=Max Vertical Tooltip Rows (0 - disable) nei.options.inventory.bookmarks.showRecipeHandlerIcon=Show Handler Icon nei.options.inventory.bookmarks.showRecipeHandlerIcon.true=Yes nei.options.inventory.bookmarks.showRecipeHandlerIcon.false=No