From 7d593ec3ab105a571f7ec04828557d406d3344d5 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 19 Jun 2019 15:49:04 +0800 Subject: stuff --- .../shedaniel/rei/gui/VillagerRecipeViewingScreen.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java') 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> categoryMap; - private final List categories; + private final Map, List> categoryMap; + private final List> categories; private final List widgets; private final List buttonWidgets; private final List recipeRenderers; @@ -56,7 +56,7 @@ public class VillagerRecipeViewingScreen extends Screen { private boolean draggingScrollBar = false; private int tabsPage; - public VillagerRecipeViewingScreen(Map> map) { + public VillagerRecipeViewingScreen(Map, List> 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 category = (RecipeCategory) 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); @@ -249,6 +249,14 @@ public class VillagerRecipeViewingScreen extends Screen { return super.mouseClicked(mouseX, mouseY, int_1); } + @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)); -- cgit