aboutsummaryrefslogtreecommitdiff
path: root/runtime/src/main/java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2022-04-13 20:29:04 +0800
committershedaniel <daniel@shedaniel.me>2022-04-13 23:26:40 +0800
commitedf0e9e19e4779bc5bccf97884953387fd2f4038 (patch)
tree2cef0c73d888733cc51c993608e60087cc305e07 /runtime/src/main/java
parentea718c672d0b4b554f45e95205f16c6a2628b817 (diff)
downloadRoughlyEnoughItems-edf0e9e19e4779bc5bccf97884953387fd2f4038.tar.gz
RoughlyEnoughItems-edf0e9e19e4779bc5bccf97884953387fd2f4038.tar.bz2
RoughlyEnoughItems-edf0e9e19e4779bc5bccf97884953387fd2f4038.zip
Check non-empty for craftable filter, Fix #663
Diffstat (limited to 'runtime/src/main/java')
-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));
}
}