aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java')
-rw-r--r--src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java
index a657c49b4..5a93b32d5 100644
--- a/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java
+++ b/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java
@@ -41,8 +41,8 @@ import java.util.stream.Collectors;
public class VillagerRecipeViewingScreen extends Screen {
private static final int TABS_PER_PAGE = 8;
- private final Map<RecipeCategory, List<RecipeDisplay>> categoryMap;
- private final List<RecipeCategory> categories;
+ private final Map<RecipeCategory<?>, List<RecipeDisplay>> categoryMap;
+ private final List<RecipeCategory<?>> categories;
private final List<Widget> widgets;
private final List<ButtonWidget> buttonWidgets;
private final List<Renderer> recipeRenderers;
@@ -56,7 +56,7 @@ public class VillagerRecipeViewingScreen extends Screen {
private boolean draggingScrollBar = false;
private int tabsPage;
- public VillagerRecipeViewingScreen(Map<RecipeCategory, List<RecipeDisplay>> map) {
+ public VillagerRecipeViewingScreen(Map<RecipeCategory<?>, List<RecipeDisplay>> map) {
super(new TextComponent(""));
this.widgets = Lists.newArrayList();
this.categoryMap = Maps.newLinkedHashMap();
@@ -90,7 +90,7 @@ public class VillagerRecipeViewingScreen extends Screen {
this.tabs.clear();
int largestWidth = width - 100;
int largestHeight = height - 40;
- RecipeCategory category = categories.get(selectedCategoryIndex);
+ RecipeCategory<RecipeDisplay> category = (RecipeCategory<RecipeDisplay>) categories.get(selectedCategoryIndex);
RecipeDisplay display = categoryMap.get(category).get(selectedRecipeIndex);
int guiWidth = MathHelper.clamp(category.getDisplayWidth(display) + 30, 0, largestWidth) + 100;
int guiHeight = MathHelper.clamp(category.getDisplayHeight() + 40, 166, largestHeight);
@@ -250,6 +250,14 @@ public class VillagerRecipeViewingScreen extends Screen {
}
@Override
+ public boolean charTyped(char char_1, int int_1) {
+ for(Element listener : children())
+ if (listener.charTyped(char_1, int_1))
+ return true;
+ return super.charTyped(char_1, int_1);
+ }
+
+ @Override
public boolean mouseScrolled(double double_1, double double_2, double double_3) {
double height = buttonWidgets.stream().map(ButtonWidget::getBounds).collect(Collectors.summingDouble(Rectangle::getHeight));
if (scrollListBounds.contains(double_1, double_2) && height > scrollListBounds.height - 2) {