Skip to content

Commit

Permalink
Fix #1614
Browse files Browse the repository at this point in the history
  • Loading branch information
shedaniel committed Apr 29, 2024
1 parent 6527c13 commit d21610b
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ protected void renderEntries(boolean fastEntryRendering, PoseStack matrices, int
}

public int getTotalPages() {
return getTotalPages(entries);
}

public int getTotalPages(List<?> entries) {
return Mth.ceil(stacks.size() / (float) entries.size());
}

Expand All @@ -136,7 +140,7 @@ protected void updateEntries(int entrySize, boolean zoomed) {
}
}
}
page = Math.max(Math.min(page, getTotalPages() - 1), 0);
page = Mth.clamp(page, 0, getTotalPages(entries) - 1);
int skip = Math.max(0, page * entries.size());
List</*EntryStack<?> | List<EntryStack<?>>*/ Object> subList = stacks.subList(skip, Math.min(stacks.size(), skip + entries.size()));
Int2ObjectMap<CollapsedStack> indexedCollapsedStack = getCollapsedStackIndexed();
Expand Down

0 comments on commit d21610b

Please sign in to comment.