aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2020-01-06 15:01:10 +0800
committershedaniel <daniel@shedaniel.me>2020-01-06 15:01:10 +0800
commit0d8c3fa7d1422067ec3c4a1b2d624db9afb54ab4 (patch)
tree27ede6fd331aa9641b3a3d55dddaa084011c2ae2 /src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java
parent22494701d3080868d6dbf4d5ae9f4100a5332d9e (diff)
downloadRoughlyEnoughItems-0d8c3fa7d1422067ec3c4a1b2d624db9afb54ab4.tar.gz
RoughlyEnoughItems-0d8c3fa7d1422067ec3c4a1b2d624db9afb54ab4.tar.bz2
RoughlyEnoughItems-0d8c3fa7d1422067ec3c4a1b2d624db9afb54ab4.zip
3.3.4
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java')
-rw-r--r--src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java b/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java
index 0906e5a2d..c9fe5c05d 100644
--- a/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java
+++ b/src/main/java/me/shedaniel/rei/gui/entries/SimpleRecipeEntry.java
@@ -19,7 +19,6 @@ import net.minecraft.util.math.MathHelper;
import javax.annotation.Nullable;
import java.util.Comparator;
import java.util.List;
-import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Supplier;
import java.util.stream.Collectors;
@@ -35,9 +34,9 @@ public class SimpleRecipeEntry extends RecipeEntry {
List<Pair<List<EntryStack>, AtomicInteger>> newList = Lists.newArrayList();
List<Pair<List<EntryStack>, Integer>> a = CollectionUtils.map(input, stacks -> new Pair<>(stacks, stacks.stream().map(EntryStack::getAmount).max(Integer::compareTo).orElse(1)));
for (Pair<List<EntryStack>, Integer> pair : a) {
- Optional<Pair<List<EntryStack>, AtomicInteger>> any = newList.stream().filter(pairr -> equalsList(pair.getLeft(), pairr.getLeft())).findAny();
- if (any.isPresent()) {
- any.get().getRight().addAndGet(pair.getRight());
+ Pair<List<EntryStack>, AtomicInteger> any = CollectionUtils.findFirstOrNull(newList, pairr -> equalsList(pair.getLeft(), pairr.getLeft()));
+ if (any != null) {
+ any.getRight().addAndGet(pair.getRight());
} else
newList.add(new Pair<>(pair.getLeft(), new AtomicInteger(pair.getRight())));
}
@@ -48,9 +47,7 @@ public class SimpleRecipeEntry extends RecipeEntry {
s.setAmount(pair.getRight().get());
return s;
}).collect(Collectors.toList()));
- this.inputWidgets = b.stream().filter(stacks -> !stacks.isEmpty()).map(stacks -> {
- return EntryWidget.create(0, 0).entries(stacks).noBackground().noHighlight().noTooltips();
- }).collect(Collectors.toList());
+ this.inputWidgets = b.stream().filter(stacks -> !stacks.isEmpty()).map(stacks -> EntryWidget.create(0, 0).entries(stacks).noBackground().noHighlight().noTooltips()).collect(Collectors.toList());
this.outputWidget = EntryWidget.create(0, 0).entries(CollectionUtils.filter(output, stack -> !stack.isEmpty())).noBackground().noHighlight().noTooltips();
}