aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2022-04-13 20:29:04 +0800
committershedaniel <daniel@shedaniel.me>2022-04-13 20:45:34 +0800
commit8d97f66088f288f90b9d408e23cfd08341f772a9 (patch)
tree6470ca1a9d0d61f28310f0bf7106d0aaeb8b0df0
parent5d8b72da3c3dfe386c3e0450687a4fa5162e5e18 (diff)
downloadRoughlyEnoughItems-8d97f66088f288f90b9d408e23cfd08341f772a9.tar.gz
RoughlyEnoughItems-8d97f66088f288f90b9d408e23cfd08341f772a9.tar.bz2
RoughlyEnoughItems-8d97f66088f288f90b9d408e23cfd08341f772a9.zip
Check non-empty for craftable filter, Fix #663
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java
index ee348b71b..80b453d50 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java
@@ -379,6 +379,7 @@ public class ViewsImpl implements Views {
Iterable<SlotAccessor> inputSlots = info != null ? info.getInputSlots(context.withDisplay(display)) : Collections.emptySet();
int slotsCraftable = 0;
+ boolean containsNonEmpty = false;
List<EntryIngredient> requiredInput = display.getRequiredEntries();
Long2LongMap invCount = new Long2LongOpenHashMap(CraftableFilter.INSTANCE.getInvStacks());
for (SlotAccessor inputSlot : inputSlots) {
@@ -409,12 +410,13 @@ public class ViewsImpl implements Views {
long availableAmount = invCount.get(hashFuzzy);
if (availableAmount >= stack.getCount()) {
invCount.put(hashFuzzy, availableAmount - stack.getCount());
+ containsNonEmpty = true;
slotsCraftable++;
break;
}
}
}
- if (slotsCraftable == display.getRequiredEntries().size()) {
+ if (slotsCraftable == display.getRequiredEntries().size() && containsNonEmpty) {
display.getOutputEntries().stream().flatMap(Collection::stream).collect(Collectors.toCollection(() -> craftables));
}
}