diff --git a/src/main/java/com/nomiceu/nomilabs/mixin/gregtech/VirtualizedRecipeMapMixin.java b/src/main/java/com/nomiceu/nomilabs/mixin/gregtech/VirtualizedRecipeMapMixin.java index e8e11cae..83960843 100644 --- a/src/main/java/com/nomiceu/nomilabs/mixin/gregtech/VirtualizedRecipeMapMixin.java +++ b/src/main/java/com/nomiceu/nomilabs/mixin/gregtech/VirtualizedRecipeMapMixin.java @@ -99,43 +99,50 @@ private boolean removeByInput(Predicate condition, List items @Unique @Nullable - public List findByOutput(long voltage, List inputs, List fluidInputs, + public List findByOutput(long voltage, List items, List fluids, List chancedItems, List chancedFluids) { - inputs = validateList(inputs); - fluidInputs = validateList(fluidInputs); + items = validateList(items); + fluids = validateList(fluids); chancedItems = validateList(chancedItems); chancedFluids = validateList(chancedFluids); - return getAccessibleRecipeMap().findRecipeByOutput(voltage, inputs, fluidInputs, chancedItems, chancedFluids); + + List filteredItems = items.stream().filter((s) -> !s.isEmpty()).collect(Collectors.toList()); + List filteredFluids = fluids.stream().filter((f) -> f != null && f.amount != 0) + .collect(Collectors.toList()); + return getAccessibleRecipeMap().findRecipeByOutput(voltage, filteredItems, filteredFluids, chancedItems, + chancedFluids); } @Unique @Nullable - public List findByOutput(List inputs, List fluidInputs, + public List findByOutput(List items, List fluids, List chancedItems, List chancedFluids) { - return findByOutput((r) -> true, inputs, fluidInputs, chancedItems, chancedFluids); + return findByOutput((r) -> true, items, fluids, chancedItems, chancedFluids); } @Unique @Nullable - public List findRecipeByOutput(GTRecipeCategory category, List inputs, - List fluidInputs, + public List findRecipeByOutput(GTRecipeCategory category, List items, + List fluids, List chancedItems, List chancedFluids) { - return findByOutput((r) -> Objects.equals(r.getRecipeCategory(), category), inputs, fluidInputs, chancedItems, + return findByOutput((r) -> Objects.equals(r.getRecipeCategory(), category), items, fluids, chancedItems, chancedFluids); } @Unique - public List findByOutput(Predicate condition, List inputs, List fluidInputs, + public List findByOutput(Predicate condition, List items, List fluids, List chancedItems, List chancedFluids) { - inputs = validateList(inputs); - fluidInputs = validateList(fluidInputs); + items = validateList(items); + fluids = validateList(fluids); chancedItems = validateList(chancedItems); chancedFluids = validateList(chancedFluids); - List items = inputs.stream().filter((s) -> !s.isEmpty()).collect(Collectors.toList()); - List fluids = fluidInputs.stream().filter((f) -> f != null && f.amount != 0) + + List filteredItems = items.stream().filter((s) -> !s.isEmpty()).collect(Collectors.toList()); + List filteredFluids = fluids.stream().filter((f) -> f != null && f.amount != 0) .collect(Collectors.toList()); - return getAccessibleRecipeMap().findByOutput(items, fluids, chancedItems, chancedFluids, condition); + return getAccessibleRecipeMap().findByOutput(filteredItems, filteredFluids, chancedItems, chancedFluids, + condition); } @Unique