aboutsummaryrefslogtreecommitdiff
path: root/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2020-08-30 21:29:58 +0800
committershedaniel <daniel@shedaniel.me>2020-08-30 21:29:58 +0800
commit8d77ad86b203de62aa08a5ee62f91e27fd0fbd00 (patch)
tree72c8f0a412591fce05ba85a9a075592a0c9d4ea2 /RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
parent2f0e6aa2024fae2d210ed40a56435d86510ce66a (diff)
downloadRoughlyEnoughItems-8d77ad86b203de62aa08a5ee62f91e27fd0fbd00.tar.gz
RoughlyEnoughItems-8d77ad86b203de62aa08a5ee62f91e27fd0fbd00.tar.bz2
RoughlyEnoughItems-8d77ad86b203de62aa08a5ee62f91e27fd0fbd00.zip
Fix brewing potions not appearing and allow scrolling in the tabs for villager like recipe viewing screen
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java')
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java21
1 files changed, 7 insertions, 14 deletions
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
index d97953d72..1cb9b885f 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
@@ -74,10 +74,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.*;
@ApiStatus.Internal
public class ContainerScreenOverlay extends WidgetWithBounds implements REIOverlay {
@@ -498,7 +495,6 @@ public class ContainerScreenOverlay extends WidgetWithBounds implements REIOverl
@Override
public void render(PoseStack matrices, int mouseX, int mouseY, float delta) {
- List<ItemStack> currentStacks = ClientHelper.getInstance().getInventoryItemsTypes();
if (shouldReInit) {
ENTRY_LIST_WIDGET.updateSearch(ScreenHelper.getSearchField().getText(), true);
init();
@@ -510,9 +506,12 @@ public class ContainerScreenOverlay extends WidgetWithBounds implements REIOverl
}
}
}
- if (ConfigManager.getInstance().isCraftableOnlyEnabled() && ((currentStacks.size() != ScreenHelper.inventoryStacks.size()) || !hasSameListContent(new LinkedList<>(ScreenHelper.inventoryStacks), currentStacks))) {
- ScreenHelper.inventoryStacks = currentStacks;
- ENTRY_LIST_WIDGET.updateSearch(ScreenHelper.getSearchField().getText(), true);
+ if (ConfigManager.getInstance().isCraftableOnlyEnabled()) {
+ Set<EntryStack> currentStacks = ClientHelperImpl.getInstance()._getInventoryItemsTypes();
+ if (!currentStacks.equals(ScreenHelper.inventoryStacks)) {
+ ScreenHelper.inventoryStacks = currentStacks;
+ ENTRY_LIST_WIDGET.updateSearch(ScreenHelper.getSearchField().getText(), true);
+ }
}
if (OverlaySearchField.isSearching) {
matrices.pushPose();
@@ -596,12 +595,6 @@ public class ContainerScreenOverlay extends WidgetWithBounds implements REIOverl
ScreenHelper.drawHoveringWidget(matrices, mouseX, mouseY, renderTooltipCallback, tooltipWidth, tooltipHeight, 0);
}
- private boolean hasSameListContent(List<ItemStack> list1, List<ItemStack> list2) {
- list1.sort(Comparator.comparing(Object::toString));
- list2.sort(Comparator.comparing(Object::toString));
- return CollectionUtils.mapAndJoinToString(list1, Object::toString, "").equals(CollectionUtils.mapAndJoinToString(list2, Object::toString, ""));
- }
-
public void addTooltip(@Nullable Tooltip tooltip) {
if (tooltip != null)
TOOLTIPS.add(tooltip);