Skip to content

Commit

Permalink
Fix #1070
Browse files Browse the repository at this point in the history
  • Loading branch information
shedaniel committed Aug 15, 2022
1 parent 71a7e06 commit 685861c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ protected final Int2ObjectMap<CollapsedStack> getCollapsedStackIndexed() {
}

@Override
public List</*EntryStack<?> | CollapsedStack*/ Object> getCollapsedStacks() {
return collapsedStacks;
public boolean isEmpty() {
return collapsedStacks.isEmpty();
}

@Override
Expand Down Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public void updateEntriesPosition() {

protected abstract void updateEntries(int entrySize, boolean zoomed);

public abstract List</*EntryStack<?> | CollapsedStack*/ Object> getCollapsedStacks();
public abstract boolean isEmpty();

protected abstract void setCollapsedStacks(List</*EntryStack<?> | CollapsedStack*/ Object> stacks);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,12 @@ protected void updateEntries(int entrySize, boolean zoomed) {
entry.entries((List<EntryStack<?>>) 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 685861c

Please sign in to comment.