From 412415120850b7f2713a89fdf849e2acbd42237f Mon Sep 17 00:00:00 2001 From: Wilhelm Schuster Date: Sat, 13 May 2023 17:40:08 +0200 Subject: [PATCH] Prevent recipe handler tab scrolling from overwriting recipe handler-specific scrolling (#384) * Rename variable in GuiRecipeTabs to avoid confusion Based on feedback in a previous PR review. * Make sure recipe handler-specific scrolling behavior takes precedence over recipe handler tab scrolling --- src/main/java/codechicken/nei/recipe/GuiRecipe.java | 4 ++-- .../java/codechicken/nei/recipe/GuiRecipeTabs.java | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/codechicken/nei/recipe/GuiRecipe.java b/src/main/java/codechicken/nei/recipe/GuiRecipe.java index 18c39102..ec0ce500 100644 --- a/src/main/java/codechicken/nei/recipe/GuiRecipe.java +++ b/src/main/java/codechicken/nei/recipe/GuiRecipe.java @@ -388,10 +388,10 @@ public abstract class GuiRecipe extends GuiContainer i // the value of the height field will be different from in other mouseover methods, which // could be confusing... - if (recipeTabs.mouseScrolled(i)) return; - for (int recipe : getRecipeIndices()) if (handler.mouseScrolled(this, i, recipe)) return; + if (recipeTabs.mouseScrolled(i)) return; + if (new Rectangle(guiLeft, guiTop, xSize, ySize).contains(GuiDraw.getMousePosition())) { if (i > 0) prevPage(); else nextPage(); diff --git a/src/main/java/codechicken/nei/recipe/GuiRecipeTabs.java b/src/main/java/codechicken/nei/recipe/GuiRecipeTabs.java index 4b6f7db5..8f285d16 100644 --- a/src/main/java/codechicken/nei/recipe/GuiRecipeTabs.java +++ b/src/main/java/codechicken/nei/recipe/GuiRecipeTabs.java @@ -198,14 +198,14 @@ public class GuiRecipeTabs { } protected boolean mouseScrolled(int i) { - Point mPos = getMousePosition(); + Point mousePosition = getMousePosition(); // Switch recipe handler tabs if either left shift is held or the tab // bar is enable and the mouse cursor is positioned over said tab bar. - if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) - || (NEIClientConfig.areJEIStyleTabsVisible() && (mPos.x >= area.x && mPos.x <= (area.x + area.width) - && mPos.y >= area.y - && mPos.y <= (area.y + area.height)))) { + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || (NEIClientConfig.areJEIStyleTabsVisible() + && (mousePosition.x >= area.x && mousePosition.x <= (area.x + area.width) + && mousePosition.y >= area.y + && mousePosition.y <= (area.y + area.height)))) { if (i < 0) guiRecipe.nextType(); else guiRecipe.prevType();