aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornea <romangraef@gmail.com>2022-10-29 01:15:19 +0200
committernea <romangraef@gmail.com>2022-10-29 01:15:19 +0200
commit08d6696c36b116f9fe537b767fa23e57afe87cbc (patch)
tree2380f0e1e30f28cd16fcf4db16c9046637e4fc5c
parent8832bff4c5e61fb1019b8ad13cec636dd7b0dd44 (diff)
downloadNotEnoughUpdates-08d6696c36b116f9fe537b767fa23e57afe87cbc.tar.gz
NotEnoughUpdates-08d6696c36b116f9fe537b767fa23e57afe87cbc.tar.bz2
NotEnoughUpdates-08d6696c36b116f9fe537b767fa23e57afe87cbc.zip
Make recipe tabs work again
why do people always break my code :sob:
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java19
1 files changed, 17 insertions, 2 deletions
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 0a1e5b81..88d2c6a0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
@@ -278,7 +278,7 @@ public class GuiItemRecipe extends GuiScreen {
super.mouseClicked(mouseX, mouseY, mouseButton);
NeuRecipe currentRecipe = getCurrentRecipe();
int[] topLeft = currentRecipe.getPageFlipPositionLeftTopCorner();
- ArrowPagesUtils.onPageSwitchMouse(
+ if (ArrowPagesUtils.onPageSwitchMouse(
guiLeft,
guiTop,
topLeft,
@@ -286,7 +286,22 @@ public class GuiItemRecipe extends GuiScreen {
getCurrentRecipeList().size(),
pageChange ->
changeRecipe(currentTab, pageChange)
- );
+ )) return;
+
+ for (int i = 0; i < tabs.size(); i++) {
+ if (isWithinRect(
+ mouseX - guiLeft,
+ mouseY - guiTop,
+ TAB_POS_X,
+ TAB_POS_Y + TAB_OFFSET_Y * i,
+ TAB_SIZE_X,
+ TAB_SIZE_Y
+ )) {
+ changeRecipe(i, currentIndex);
+ Utils.playPressSound();
+ return;
+ }
+ }
for (RecipeSlot slot : getAllRenderedSlots()) {
if (isWithinRect(mouseX, mouseY, slot.getX(this), slot.getY(this), SLOT_SIZE, SLOT_SIZE)) {