From 8d742e5a471aa2399cd077a9cda9883a0b7c1bb7 Mon Sep 17 00:00:00 2001 From: Hendrik Horstmann <65970327+heinrich26@users.noreply.github.com> Date: Mon, 2 Oct 2023 21:22:12 +0200 Subject: Scrolling through recipes (#841) * Enable recipe paging with mouse wheel * Only scroll while no tooltip is displayed / tooltip-scrolling is disable * Update GuiItemRecipe.java Make the comment more clear. --- .../moulberry/notenoughupdates/miscgui/GuiItemRecipe.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java index 3627a94e..6dc64ab6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java @@ -22,6 +22,7 @@ package io.github.moulberry.notenoughupdates.miscgui; import com.google.common.collect.ImmutableList; import io.github.moulberry.notenoughupdates.NEUManager; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.TooltipTextScrolling; import io.github.moulberry.notenoughupdates.core.util.ArrowPagesUtils; import io.github.moulberry.notenoughupdates.recipes.NeuRecipe; import io.github.moulberry.notenoughupdates.recipes.RecipeHistory; @@ -336,6 +337,17 @@ public class GuiItemRecipe extends GuiScreen { int mouseY = scaledResolution.getScaledHeight() - Mouse.getY() * scaledResolution.getScaledHeight() / Minecraft.getMinecraft().displayHeight - 1; getCurrentRecipe().genericMouseInput(mouseX, mouseY); + + + // Allow Paging with Scroll-Wheel + + // Block scrolling while Tooltip is displayed + if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.scrollableTooltips && + TooltipTextScrolling.didRenderTooltip) return; + + if (Mouse.getEventDWheel() != 0) { + ArrowPagesUtils.onPageSwitchScroll(currentIndex, getCurrentRecipeList().size(), pageChange -> changeRecipe(currentTab, pageChange)); + } } public void arrowKeyboardInput() { -- cgit