From 4e035b03124e4eb5cab04a2f52e87d10dc424333 Mon Sep 17 00:00:00 2001 From: BlueAgent Date: Thu, 24 Jun 2021 21:26:40 +0800 Subject: [PATCH] Fix craftable stack vanishing or duplicating when using craftable view When an associated non-craftable stack was: - Fully removed, the craftable stack duplicated. - Newly added, the craftable stack vanished. --- .../refinedstorage/screen/grid/view/GridViewImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/refinedmods/refinedstorage/screen/grid/view/GridViewImpl.java b/src/main/java/com/refinedmods/refinedstorage/screen/grid/view/GridViewImpl.java index f8cf0a345..f4a14db7a 100644 --- a/src/main/java/com/refinedmods/refinedstorage/screen/grid/view/GridViewImpl.java +++ b/src/main/java/com/refinedmods/refinedstorage/screen/grid/view/GridViewImpl.java @@ -141,6 +141,7 @@ public class GridViewImpl implements IGridView { craftingStack = null; } + Predicate activeFilters = getActiveFilters(); IGridStack existing = map.get(stack.getId()); boolean stillExists = true; boolean shouldSort = screen.canSort(); @@ -151,7 +152,7 @@ public class GridViewImpl implements IGridView { map.put(stack.getId(), stack); existing = stack; - if (craftingStack != null && shouldSort) { + if (craftingStack != null && shouldSort && activeFilters.test(existing)) { stacks.remove(craftingStack); } } else { @@ -163,7 +164,7 @@ public class GridViewImpl implements IGridView { map.remove(existing.getId()); stillExists = false; - if (craftingStack != null && shouldSort && getActiveFilters().test(craftingStack)) { + if (craftingStack != null && shouldSort && activeFilters.test(existing) && activeFilters.test(craftingStack)) { addStack(craftingStack); } } @@ -172,7 +173,7 @@ public class GridViewImpl implements IGridView { } if (shouldSort) { - if (stillExists && getActiveFilters().test(existing)) { + if (stillExists && activeFilters.test(existing)) { addStack(existing); } this.screen.updateScrollbar();