diff options
| author | shedaniel <daniel@shedaniel.me> | 2020-07-18 15:41:13 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2020-07-18 15:41:13 +0800 |
| commit | d4d23b0b0170f605463c49f5790e7326c7e38cf2 (patch) | |
| tree | 77d6ef0d22d5582158ac966e2ebf99b54a78e197 /src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java | |
| parent | d57067c1e6cd6fb400d43cfc4149515df1fb8435 (diff) | |
| download | RoughlyEnoughItems-d4d23b0b0170f605463c49f5790e7326c7e38cf2.tar.gz RoughlyEnoughItems-d4d23b0b0170f605463c49f5790e7326c7e38cf2.tar.bz2 RoughlyEnoughItems-d4d23b0b0170f605463c49f5790e7326c7e38cf2.zip | |
Fix #385 and optimise favourites rendering
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java index 6d75f7d23..5a405f08b 100644 --- a/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java @@ -253,19 +253,32 @@ public class VillagerRecipeViewingScreen extends Screen implements RecipeScreen } @Override - public boolean mouseClicked(double mouseX, double mouseY, int int_1) { - if (scrolling.updateDraggingState(mouseX, mouseY, int_1)) { + public boolean mouseClicked(double mouseX, double mouseY, int button) { + if (scrolling.updateDraggingState(mouseX, mouseY, button)) { scrollBarAlpha = 1; return true; } + if (ConfigObject.getInstance().getNextPageKeybind().matchesMouse(button)) { + selectedRecipeIndex++; + if (selectedRecipeIndex >= categoryMap.get(categories.get(selectedCategoryIndex)).size()) + selectedRecipeIndex = 0; + init(); + return true; + } else if (ConfigObject.getInstance().getPreviousPageKeybind().matchesMouse(button)) { + selectedRecipeIndex--; + if (selectedRecipeIndex < 0) + selectedRecipeIndex = categoryMap.get(categories.get(selectedCategoryIndex)).size() - 1; + init(); + return true; + } for (Element entry : children()) - if (entry.mouseClicked(mouseX, mouseY, int_1)) { + if (entry.mouseClicked(mouseX, mouseY, button)) { setFocused(entry); - if (int_1 == 0) + if (button == 0) setDragging(true); return true; } - return super.mouseClicked(mouseX, mouseY, int_1); + return super.mouseClicked(mouseX, mouseY, button); } @Override @@ -296,6 +309,7 @@ public class VillagerRecipeViewingScreen extends Screen implements RecipeScreen if (selectedRecipeIndex >= categoryMap.get(categories.get(selectedCategoryIndex)).size()) selectedRecipeIndex = 0; init(); + return true; } else if (categoryMap.get(categories.get(selectedCategoryIndex)).size() > 1) { selectedRecipeIndex--; if (selectedRecipeIndex < 0) |
