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
This commit is contained in:
Wilhelm Schuster authored and GitHub committed 2023-05-13 17:40:08 +02:00
1 parent 68ad800620
commit 4124151208
2 files changed
+7 -7

No files matched your search

@@ -388,10 +388,10 @@ public abstract class GuiRecipe<H extends IRecipeHandler> 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();
@@ -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();