mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-13 00:47:35 +00:00
fix bookmarks Infinite loop in todo list (#442)
Co-authored-by: slprime <history-21@yandex.ru>
This commit is contained in:
1 parent
2fc2ecf082
commit
9b081ed2a7
1 file changed
+21
-7
@@ -177,29 +177,43 @@ public class BookmarkPanel extends PanelWidget {
|
||||
}
|
||||
|
||||
BookmarkStackMeta meta;
|
||||
boolean isFirstColumn = false;
|
||||
boolean isIngredient = false;
|
||||
int size = size();
|
||||
int idx = 0;
|
||||
|
||||
while (idx < size) {
|
||||
ArrayList<Integer> pmask = new ArrayList<>();
|
||||
int lastIdx = idx;
|
||||
|
||||
for (int i = 0, perPage = rows * columns; i < perPage && idx < size; i++) {
|
||||
|
||||
if (isInvalidSlot(i)) {
|
||||
pmask.add(null);
|
||||
} else {
|
||||
meta = getMetadata(idx);
|
||||
isFirstColumn = (i % columns) == 0;
|
||||
isIngredient = meta.recipeId != null && meta.ingredient;
|
||||
|
||||
if (idx > 0 && ((i % columns) == 0) == (meta.recipeId != null && meta.ingredient
|
||||
&& meta.recipeId.equals(getRecipeId(idx - 1)))) {
|
||||
pmask.add(null);
|
||||
} else {
|
||||
if (isFirstColumn && !isIngredient) {
|
||||
pmask.add(idx++);
|
||||
|
||||
if ((i % columns) == 0) {
|
||||
todoItemsCount++;
|
||||
}
|
||||
todoItemsCount++;
|
||||
} else if (isIngredient && (!isFirstColumn || i + 1 < perPage && isInvalidSlot(i + 1))) {
|
||||
// The ingredients that do not fit on the first line are moved to the second starting with
|
||||
// the second column. This condition checks whether the second column is available. If not
|
||||
// available, the ingredient takes the first column
|
||||
pmask.add(idx++);
|
||||
} else {
|
||||
pmask.add(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (lastIdx == idx) {
|
||||
break;
|
||||
}
|
||||
|
||||
gridMask.add(pmask);
|
||||
|
||||
Reference in new issue
Block a user