aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java
diff options
context:
space:
mode:
authorDanielshe <shekwancheung0528@gmail.com>2019-11-03 14:44:52 +0800
committerDanielshe <shekwancheung0528@gmail.com>2019-11-03 14:44:59 +0800
commit9f5a9eae9a7863412cc5eb433bf15e5ee71da616 (patch)
tree0e6b0b94af061c5e9023b1ff19f339a6c30149be /src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java
parent3e3e25855b9f6df507a7d4c8a07c64b9a502fae2 (diff)
downloadRoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.tar.gz
RoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.tar.bz2
RoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.zip
3.2.1
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java')
-rw-r--r--src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java19
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);