diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-06-19 15:49:04 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-06-19 15:49:04 +0800 |
| commit | 7d593ec3ab105a571f7ec04828557d406d3344d5 (patch) | |
| tree | 38dd3bd53f7343df7f0ed61d18a5c01ee2306fde /src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java | |
| parent | 6ad47cbb6e26bf74b1f432f59c5779c5905297dd (diff) | |
| download | RoughlyEnoughItems-7d593ec3ab105a571f7ec04828557d406d3344d5.tar.gz RoughlyEnoughItems-7d593ec3ab105a571f7ec04828557d406d3344d5.tar.bz2 RoughlyEnoughItems-7d593ec3ab105a571f7ec04828557d406d3344d5.zip | |
stuff
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java | 16 |
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) { |
