diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/CollapsingEntryListWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/CollapsingEntryListWidget.java index af0fb2900..fe2d8b7e8 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/CollapsingEntryListWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/CollapsingEntryListWidget.java @@ -48,8 +48,8 @@ protected final Int2ObjectMap getCollapsedStackIndexed() { } @Override - public List | CollapsedStack*/ Object> getCollapsedStacks() { - return collapsedStacks; + public boolean isEmpty() { + return collapsedStacks.isEmpty(); } @Override @@ -97,7 +97,7 @@ private void updateStacks() { if (collapsedStack != null) { collapsedStackIndexed.put(index, collapsedStack); - + if (collapsedStack.isExpanded()) { int size = collapsedStack.getIngredient().size(); for (int i = 1; i < size; i++) { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/EntryListWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/EntryListWidget.java index 3b6359d53..30aa0de60 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/EntryListWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/EntryListWidget.java @@ -273,7 +273,7 @@ public void updateEntriesPosition() { protected abstract void updateEntries(int entrySize, boolean zoomed); - public abstract List | CollapsedStack*/ Object> getCollapsedStacks(); + public abstract boolean isEmpty(); protected abstract void setCollapsedStacks(List | CollapsedStack*/ Object> stacks); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/PaginatedEntryListWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/PaginatedEntryListWidget.java index d239a772d..fb7c864c5 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/PaginatedEntryListWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/PaginatedEntryListWidget.java @@ -151,7 +151,12 @@ protected void updateEntries(int entrySize, boolean zoomed) { entry.entries((List>) stack); } - entry.collapsed(indexedCollapsedStack.get(i + skip)); + CollapsedStack collapsedStack = indexedCollapsedStack.get(i + skip); + if (collapsedStack != null && collapsedStack.getIngredient().size() > 1) { + entry.collapsed(collapsedStack); + } else { + entry.collapsed(null); + } } this.entries = entries; } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/ScrolledEntryListWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/ScrolledEntryListWidget.java index 2fa942752..fda8ec704 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/ScrolledEntryListWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/ScrolledEntryListWidget.java @@ -96,7 +96,12 @@ protected void renderEntries(boolean fastEntryRendering, PoseStack matrices, int } } - entry.collapsed(indexedCollapsedStack.get(i - 1)); + CollapsedStack collapsedStack = indexedCollapsedStack.get(i - 1); + if (collapsedStack != null && collapsedStack.getIngredient().size() > 1) { + entry.collapsed(collapsedStack); + } else { + entry.collapsed(null); + } } else { blockedCount++; } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/search/OverlaySearchField.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/search/OverlaySearchField.java index c6dd42ef0..4168b1916 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/search/OverlaySearchField.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/search/OverlaySearchField.java @@ -97,7 +97,7 @@ public FormattedCharSequence format(TextFieldWidget widget, String text, int ind return TextTransformations.forwardWithTransformation(text, (s, charIndex, c) -> { byte arg = highlighter.highlighted[charIndex + index]; Style style = Style.EMPTY; - if (isMain && ScreenOverlayImpl.getEntryListWidget().getCollapsedStacks().isEmpty() && !getText().isEmpty()) { + if (isMain && ScreenOverlayImpl.getEntryListWidget().isEmpty() && !getText().isEmpty()) { style = ERROR_STYLE; } if (arg > 0) { @@ -273,7 +273,7 @@ public void renderBorder(PoseStack matrices) { int borderColor; if (isMain && isHighlighting) { borderColor = 0xfff2ff0c; - } else if (isMain && ScreenOverlayImpl.getEntryListWidget().getCollapsedStacks().isEmpty() && !getText().isEmpty()) { + } else if (isMain && ScreenOverlayImpl.getEntryListWidget().isEmpty() && !getText().isEmpty()) { borderColor = 0xffff5555; } else { super.renderBorder(matrices);