Skip to content

Commit

Permalink
fix: Populate page being broken from last version, fixes #118
Browse files Browse the repository at this point in the history
  • Loading branch information
LichtHund committed Jun 4, 2024
1 parent f29b5ff commit 08cc632
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -405,11 +406,15 @@ public int getPagesNum() {
private void populatePage() {
// Adds the paginated items to the page
int slot = 0;
for (final GuiItem guiItem : getPageNum(pageNum)) {
final Iterator<GuiItem> iterator = getPageNum(pageNum).iterator();
while (iterator.hasNext()) {
if (getGuiItem(slot) != null || getInventory().getItem(slot) != null) {
slot++;
continue;
}

final GuiItem guiItem = iterator.next();

currentPage.put(slot, guiItem);
getInventory().setItem(slot, guiItem.getItemStack());
slot++;
Expand Down

0 comments on commit 08cc632

Please sign in to comment.