diff --git a/src/main/java/codechicken/nei/NEIClientConfig.java b/src/main/java/codechicken/nei/NEIClientConfig.java index 72d46b27..5c952ba2 100644 --- a/src/main/java/codechicken/nei/NEIClientConfig.java +++ b/src/main/java/codechicken/nei/NEIClientConfig.java @@ -266,9 +266,6 @@ public class NEIClientConfig { tag.getTag("inventory.guirecipe.profile").getBooleanValue(false); API.addOption(new OptionToggleButton("inventory.guirecipe.profile", true)); - tag.getTag("inventory.guirecipe.chance").getBooleanValue(false); - API.addOption(new OptionToggleButton("inventory.guirecipe.chance", true)); - tag.getTag("inventory.guirecipe.handlerInfo").setComment("ADVANCED: Handler Info Widget") .getBooleanValue(false); API.addOption(new OptionToggleButton("inventory.guirecipe.handlerInfo", true)); @@ -1143,10 +1140,6 @@ public class NEIClientConfig { return getBooleanSetting("inventory.guirecipe.shiftOverlayRecipe"); } - public static boolean showRecipeItemChances() { - return getBooleanSetting("inventory.guirecipe.chance"); - } - public static boolean isEnabled() { return enabledOverride && getBooleanSetting("inventory.widgetsenabled"); } diff --git a/src/main/java/codechicken/nei/bookmark/BookmarkGrid.java b/src/main/java/codechicken/nei/bookmark/BookmarkGrid.java index 98812065..e7dd989d 100644 --- a/src/main/java/codechicken/nei/bookmark/BookmarkGrid.java +++ b/src/main/java/codechicken/nei/bookmark/BookmarkGrid.java @@ -632,7 +632,8 @@ public class BookmarkGrid extends ItemsGrid= 0 && this.calculatedItems.containsKey(itemIndex)) { final BookmarkItem item = entry.getValue(); if (this.recipeInMiddle.contains(item.recipeId)) { - this.calculatedItems.get(itemIndex) - .setRealAmount(Math.max(0, item.getAmount(item.getMultiplier() - 1))); + this.calculatedItems.get(itemIndex).setRealMultiplier(item.getMultiplier() - 1); } else { - this.calculatedItems.get(itemIndex).setRealAmount(item.getAmount()); + this.calculatedItems.get(itemIndex).setRealMultiplier(item.getMultiplier()); } } } @@ -259,7 +262,8 @@ public class RecipeChainDetails { } if (this.calculatedItems.containsKey(itemIndex)) { - this.calculatedItems.get(itemIndex).setRealAmount(value.getShiftAmount()); + this.calculatedItems.get(itemIndex) + .setRealMultiplier(value.getItem().getMultiplierFromAmount(value.getShiftAmount())); } } @@ -284,7 +288,8 @@ public class RecipeChainDetails { } else if (amount > 0) { items.computeIfAbsent( StackInfo.getItemStackGUID(item.itemStack), - is -> BookmarkChainItem.of(item, 0, 0, CalculatedType.RESULT)).append(amount, amount); + is -> BookmarkChainItem.of(item, 0, 0, CalculatedType.RESULT)) + .append(amount, item.getAmount()); } } } diff --git a/src/main/java/codechicken/nei/config/IMCHandler.java b/src/main/java/codechicken/nei/config/IMCHandler.java index 9430cce9..6b62a2f0 100644 --- a/src/main/java/codechicken/nei/config/IMCHandler.java +++ b/src/main/java/codechicken/nei/config/IMCHandler.java @@ -103,6 +103,7 @@ public class IMCHandler { info.setUseCustomScroll(tag.hasKey("useCustomScroll") && tag.getBoolean("useCustomScroll")); info.setShowFavoritesButton(!tag.hasKey("showFavoritesButton") || tag.getBoolean("showFavoritesButton")); info.setShowOverlayButton(!tag.hasKey("showOverlayButton") || tag.getBoolean("showOverlayButton")); + info.setShowChanceInfo(!tag.hasKey("showChanceInfo") || tag.getBoolean("showChanceInfo")); GuiRecipeTab.handlerAdderFromIMC.remove(handler); GuiRecipeTab.handlerAdderFromIMC.put(handler, info); diff --git a/src/main/java/codechicken/nei/recipe/HandlerInfo.java b/src/main/java/codechicken/nei/recipe/HandlerInfo.java index d443e8d7..f8d7b67f 100644 --- a/src/main/java/codechicken/nei/recipe/HandlerInfo.java +++ b/src/main/java/codechicken/nei/recipe/HandlerInfo.java @@ -30,6 +30,7 @@ public class HandlerInfo { private boolean multipleWidgetsAllowed = false; private boolean showFavoritesButton = true; private boolean showOverlayButton = true; + private boolean showChanceInfo = true; private boolean useCustomScroll = false; private ItemStack itemStack = null; @@ -142,6 +143,14 @@ public class HandlerInfo { this.showOverlayButton = showOverlayButton; } + public boolean getShowChanceInfo() { + return this.showChanceInfo; + } + + public void setShowChanceInfo(boolean showChanceInfo) { + this.showChanceInfo = showChanceInfo; + } + public boolean getUseCustomScroll() { return this.useCustomScroll; } @@ -216,6 +225,11 @@ public class HandlerInfo { return this; } + public Builder setShowChanceInfo(boolean showChanceInfo) { + this.info.showChanceInfo = showChanceInfo; + return this; + } + @Deprecated public Builder setMaxRecipesPerPage(int maxRecipesPerPage) { this.info.multipleWidgetsAllowed = maxRecipesPerPage > 1; diff --git a/src/main/java/codechicken/nei/recipe/NEIRecipeWidget.java b/src/main/java/codechicken/nei/recipe/NEIRecipeWidget.java index b88b1be7..9388fc0a 100644 --- a/src/main/java/codechicken/nei/recipe/NEIRecipeWidget.java +++ b/src/main/java/codechicken/nei/recipe/NEIRecipeWidget.java @@ -263,7 +263,7 @@ public class NEIRecipeWidget extends Widget { protected void drawItem(PositionedStack pStack, int mouseX, int mouseY, int yShift) { GuiContainerManager.drawItem(pStack.relx, pStack.rely, pStack.item); - if (NEIClientConfig.showRecipeItemChances()) { + if (this.handlerInfo.getShowChanceInfo()) { final String chanceText = this.chances.computeIfAbsent(pStack, k -> getChanceText(k)); if (!chanceText.isEmpty()) { diff --git a/src/main/java/codechicken/nei/recipe/chain/RecipeChainMath.java b/src/main/java/codechicken/nei/recipe/chain/RecipeChainMath.java index 3b87e167..a8b479ee 100644 --- a/src/main/java/codechicken/nei/recipe/chain/RecipeChainMath.java +++ b/src/main/java/codechicken/nei/recipe/chain/RecipeChainMath.java @@ -371,8 +371,8 @@ public class RecipeChainMath { addRequiredAmount(prefItem, ingrAmount, Long.MAX_VALUE); } else { addRequiredAmount(prefItem, ingrAmount, Long.MAX_VALUE); - final long multiplier = prefItem - .getMultiplierFromAmount(this.requiredAmount.get(prefItem) - prefItem.getAmount()); + final long multiplier = Math + .max(0, prefItem.getMultiplierFromAmount(this.requiredAmount.get(prefItem)) - prefItem.multiplier); if (multiplier > 0) { addShift(prefItem.recipeId, multiplier); diff --git a/src/main/resources/assets/nei/lang/en_US.lang b/src/main/resources/assets/nei/lang/en_US.lang index 1c0df135..d5689aa4 100644 --- a/src/main/resources/assets/nei/lang/en_US.lang +++ b/src/main/resources/assets/nei/lang/en_US.lang @@ -302,9 +302,6 @@ nei.options.inventory.guirecipe.handlerInfo.tip=Use shift+d while in the Recipes nei.options.inventory.guirecipe.handlerInfo.true=Enabled nei.options.inventory.guirecipe.handlerInfo.false=Disabled nei.options.inventory.guirecipe.maxHeight=Max Height -nei.options.inventory.guirecipe.chance=Show Change -nei.options.inventory.guirecipe.chance.true=Yes -nei.options.inventory.guirecipe.chance.false=No nei.options.inventory.showItemQuantityWidget=Show Item Quantity Widget nei.options.inventory.showItemQuantityWidget.true=Yes nei.options.inventory.showItemQuantityWidget.false=No