mirror of
https://github.com/GTNewHorizons/JustEnoughCalculation.git
synced 2026-11-22 04:52:29 +00:00
feat: calculation logic start
This commit is contained in:
1 parent
477a84804e
commit
37a94075c7
23 files changed
+273
-192
No files matched your search
@@ -7,10 +7,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -98,13 +95,8 @@ public class Recipes {
|
||||
return flatStream(group).collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
public List<Triple<Recipe, String, Integer>> getRecipes(ILabel label, Recipe.enumIoType type) {
|
||||
return getRecipes(flatStream(), r -> IntStream.range(0, type.getSize()).anyMatch(i ->
|
||||
ILabel.MERGER.merge(label, r.getLabel(type)[i], true).isPresent()));
|
||||
}
|
||||
|
||||
private List<Triple<Recipe, String, Integer>> getRecipes(Stream<Triple<Recipe, String, Integer>> list, Predicate<Recipe> pre) {
|
||||
return list.filter(i -> pre.test(i.one)).collect(Collectors.toCollection(ArrayList::new));
|
||||
public Optional<Recipe> getRecipe(ILabel label, Recipe.enumIoType type) {
|
||||
return flatStream().map(i -> i.one).filter(i -> i.matches(label, type)).findFirst();
|
||||
}
|
||||
|
||||
public void forEach(BiConsumer<String, List<Recipe>> consumer) {
|
||||
|
||||
Reference in new issue
Block a user