Implement grid change in #2331

This commit is contained in:
raoulvdberge
2020-06-27 12:35:48 +02:00
parent d2e8ed5342
commit ff3277368d

View File

@@ -57,11 +57,7 @@ public abstract class BaseGridView implements IGridView {
(grid.getTabSelected() >= 0 && grid.getTabSelected() < grid.getTabs().size()) ? grid.getTabs().get(grid.getTabSelected()).getFilters() : grid.getFilters() (grid.getTabSelected() >= 0 && grid.getTabSelected() < grid.getTabs().size()) ? grid.getTabs().get(grid.getTabSelected()).getFilters() : grid.getFilters()
); );
Iterator<IGridStack> it = stacks.iterator(); stacks.removeIf(stack -> {
while (it.hasNext()) {
IGridStack stack = it.next();
// If this is a crafting stack, // If this is a crafting stack,
// and there is a regular matching stack in the view too, // and there is a regular matching stack in the view too,
// and we aren't in "view only craftables" mode, // and we aren't in "view only craftables" mode,
@@ -70,19 +66,17 @@ public abstract class BaseGridView implements IGridView {
stack.isCraftable() && stack.isCraftable() &&
stack.getOtherId() != null && stack.getOtherId() != null &&
map.containsKey(stack.getOtherId())) { map.containsKey(stack.getOtherId())) {
it.remove(); return true;
continue;
} }
for (Predicate<IGridStack> filter : filters) { for (Predicate<IGridStack> filter : filters) {
if (!filter.test(stack)) { if (!filter.test(stack)) {
it.remove(); return true;
}
}
break; return false;
} });
}
}
SortingDirection sortingDirection = grid.getSortingDirection() == IGrid.SORTING_DIRECTION_DESCENDING ? SortingDirection.DESCENDING : SortingDirection.ASCENDING; SortingDirection sortingDirection = grid.getSortingDirection() == IGrid.SORTING_DIRECTION_DESCENDING ? SortingDirection.DESCENDING : SortingDirection.ASCENDING;