aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
diff options
context:
space:
mode:
authorUnknown <shekwancheung0528@gmail.com>2019-03-19 14:25:15 +0800
committerUnknown <shekwancheung0528@gmail.com>2019-03-19 14:25:15 +0800
commitc2d28cbf7028ffed2f56169adbce3f03cc0c5b49 (patch)
tree4d96cb58c551255a08a3abde18b067174c1c1246 /src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
parent032b88e7f3784753987e9fdbf11c33d620b76d65 (diff)
downloadRoughlyEnoughItems-c2d28cbf7028ffed2f56169adbce3f03cc0c5b49.tar.gz
RoughlyEnoughItems-c2d28cbf7028ffed2f56169adbce3f03cc0c5b49.tar.bz2
RoughlyEnoughItems-c2d28cbf7028ffed2f56169adbce3f03cc0c5b49.zip
v2.5 Beta
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java')
-rw-r--r--src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
index 31ba6793d..968d6079c 100644
--- a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
+++ b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
@@ -2,6 +2,7 @@ package me.shedaniel.rei.gui;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.platform.GlStateManager;
+import me.shedaniel.cloth.ClothInitializer;
import me.shedaniel.rei.RoughlyEnoughItemsCore;
import me.shedaniel.rei.api.*;
import me.shedaniel.rei.client.ClientHelper;
@@ -128,6 +129,11 @@ public class RecipeViewingScreen extends Screen {
page = 0;
RecipeViewingScreen.this.onInitialized();
}
+
+ @Override
+ public Optional<String> getTooltips() {
+ return Optional.ofNullable(I18n.translate("text.rei.previous_category"));
+ }
});
widgets.add(new ClickableLabelWidget((int) bounds.getCenterX(), (int) bounds.getY() + 7, "") {
@Override
@@ -158,6 +164,11 @@ public class RecipeViewingScreen extends Screen {
page = 0;
RecipeViewingScreen.this.onInitialized();
}
+
+ @Override
+ public Optional<String> getTooltips() {
+ return Optional.ofNullable(I18n.translate("text.rei.next_category"));
+ }
});
categoryBack.enabled = categories.size() > 1;
categoryNext.enabled = categories.size() > 1;
@@ -170,6 +181,11 @@ public class RecipeViewingScreen extends Screen {
page = getTotalPages(selectedCategory) - 1;
RecipeViewingScreen.this.onInitialized();
}
+
+ @Override
+ public Optional<String> getTooltips() {
+ return Optional.ofNullable(I18n.translate("text.rei.previous_page"));
+ }
});
widgets.add(new ClickableLabelWidget((int) bounds.getCenterX(), (int) bounds.getY() + 23, "") {
@Override
@@ -197,9 +213,15 @@ public class RecipeViewingScreen extends Screen {
page = 0;
RecipeViewingScreen.this.onInitialized();
}
+
+ @Override
+ public Optional<String> getTooltips() {
+ return Optional.ofNullable(I18n.translate("text.rei.next_page"));
+ }
});
- recipeBack.enabled = categoriesMap.get(selectedCategory).size() > getRecipesPerPage();
- recipeNext.enabled = categoriesMap.get(selectedCategory).size() > getRecipesPerPage();
+ int recipesPerPageByHeight = getRecipesPerPageByHeight();
+ recipeBack.enabled = categoriesMap.get(selectedCategory).size() > recipesPerPageByHeight;
+ recipeNext.enabled = categoriesMap.get(selectedCategory).size() > recipesPerPageByHeight;
for(int i = 0; i < 6; i++) {
int j = i + categoryPages * 6;
@@ -360,13 +382,13 @@ public class RecipeViewingScreen extends Screen {
for(InputListener listener : listeners)
if (listener.mouseScrolled(i, j, amount))
return true;
- if (getBounds().contains(ClientHelper.getMouseLocation())) {
+ if (getBounds().contains(ClothInitializer.clientUtils.getMouseLocation())) {
if (amount > 0 && recipeBack.enabled)
recipeBack.onPressed();
else if (amount < 0 && recipeNext.enabled)
recipeNext.onPressed();
}
- if ((new Rectangle(bounds.x, bounds.y - 28, bounds.width, 28)).contains(ClientHelper.getMouseLocation())) {
+ if ((new Rectangle(bounds.x, bounds.y - 28, bounds.width, 28)).contains(ClothInitializer.clientUtils.getMouseLocation())) {
if (amount > 0 && categoryBack.enabled)
categoryBack.onPressed();
else if (amount < 0 && categoryNext.enabled)