diff options
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java index 4d02a3a5f..e212e22bd 100644 --- a/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java @@ -7,8 +7,8 @@ package me.shedaniel.rei.gui; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import me.shedaniel.clothconfig2.api.ScissorsHandler; import com.mojang.blaze3d.systems.RenderSystem; -import com.zeitheron.hammercore.client.utils.Scissors; import me.shedaniel.math.api.Point; import me.shedaniel.math.api.Rectangle; import me.shedaniel.math.impl.PointHelper; @@ -17,6 +17,7 @@ import me.shedaniel.rei.api.*; import me.shedaniel.rei.gui.renderers.RecipeRenderer; import me.shedaniel.rei.gui.widget.*; import me.shedaniel.rei.impl.ScreenHelper; +import me.shedaniel.rei.utils.CollectionUtils; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.Element; import net.minecraft.client.gui.screen.Screen; @@ -37,7 +38,6 @@ import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.stream.Collectors; public class VillagerRecipeViewingScreen extends Screen { @@ -185,7 +185,7 @@ public class VillagerRecipeViewingScreen extends Screen { return false; } }); - tab.setRenderer(categories.get(j), categories.get(j).getIcon(), categories.get(j).getCategoryName(), tab.getId() + tabsPage * TABS_PER_PAGE == selectedCategoryIndex); + tab.setRenderer(categories.get(j), categories.get(j).getLogo(), categories.get(j).getCategoryName(), tab.getId() + tabsPage * TABS_PER_PAGE == selectedCategoryIndex); } } ButtonWidget w, w2; @@ -247,7 +247,7 @@ public class VillagerRecipeViewingScreen extends Screen { @Override public boolean mouseClicked(double mouseX, double mouseY, int int_1) { - double height = buttonWidgets.stream().map(ButtonWidget::getBounds).collect(Collectors.summingDouble(Rectangle::getHeight)); + double height = CollectionUtils.sumInt(buttonWidgets, b -> b.getBounds().getHeight()); int actualHeight = scrollListBounds.height - 2; if (height > actualHeight && scrollBarAlpha > 0 && mouseY >= scrollListBounds.y + 1 && mouseY <= scrollListBounds.getMaxY() - 1) { double scrollbarPositionMinX = scrollListBounds.getMaxX() - 6; @@ -271,7 +271,7 @@ public class VillagerRecipeViewingScreen extends Screen { @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)); + double height = CollectionUtils.sumInt(buttonWidgets, b -> b.getBounds().getHeight()); if (scrollListBounds.contains(double_1, double_2) && height > scrollListBounds.height - 2) { if (double_3 > 0) scroll -= 16; @@ -337,8 +337,7 @@ public class VillagerRecipeViewingScreen extends Screen { GuiLighting.disable(); ScreenHelper.getLastOverlay().render(mouseX, mouseY, delta); RenderSystem.pushMatrix(); - Scissors.begin(); - Scissors.scissor(0, scrollListBounds.y + 1, width, scrollListBounds.height - 2); + ScissorsHandler.INSTANCE.scissor(new Rectangle(0, scrollListBounds.y + 1, width, scrollListBounds.height - 2)); for (int i = 0; i < buttonWidgets.size(); i++) { ButtonWidget buttonWidget = buttonWidgets.get(i); buttonWidget.getBounds().y = scrollListBounds.y + 1 + yOffset - (int) scroll; @@ -356,7 +355,7 @@ public class VillagerRecipeViewingScreen extends Screen { ScreenHelper.getLastOverlay().addTooltip(recipeRenderers.get(i).getQueuedTooltip(delta)); } } - double height = buttonWidgets.stream().map(ButtonWidget::getBounds).collect(Collectors.summingDouble(Rectangle::getHeight)); + double height = CollectionUtils.sumInt(buttonWidgets, b -> b.getBounds().getHeight()); if (height > scrollListBounds.height - 2) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBufferBuilder(); @@ -385,7 +384,7 @@ public class VillagerRecipeViewingScreen extends Screen { RenderSystem.enableAlphaTest(); RenderSystem.enableTexture(); } - Scissors.end(); + ScissorsHandler.INSTANCE.removeLastScissor(); RenderSystem.popMatrix(); ScreenHelper.getLastOverlay().lateRender(mouseX, mouseY, delta); } @@ -393,7 +392,7 @@ public class VillagerRecipeViewingScreen extends Screen { @Override public boolean mouseDragged(double mouseX, double mouseY, int int_1, double double_3, double double_4) { if (int_1 == 0 && scrollBarAlpha > 0 && draggingScrollBar) { - double height = buttonWidgets.stream().map(ButtonWidget::getBounds).collect(Collectors.summingDouble(Rectangle::getHeight)); + double height = CollectionUtils.sumInt(buttonWidgets, b -> b.getBounds().getHeight()); int actualHeight = scrollListBounds.height - 2; if (height > actualHeight && mouseY >= scrollListBounds.y + 1 && mouseY <= scrollListBounds.getMaxY() - 1) { int int_3 = MathHelper.clamp((int) ((actualHeight * actualHeight) / height), 32, actualHeight - 8); |
