diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-01-09 14:28:42 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-01-09 14:28:42 +0800 |
| commit | 4ab17cd1d282dc23d2a4afdc5f300227be1fc5fb (patch) | |
| tree | 73ba8f73002399c5990cc5cb23db57f8be630ea9 /src/main/java/me/shedaniel/impl | |
| parent | 72e1653cbb38282f8dce59a00fb381e18bfc795d (diff) | |
| download | RoughlyEnoughItems-4ab17cd1d282dc23d2a4afdc5f300227be1fc5fb.tar.gz RoughlyEnoughItems-4ab17cd1d282dc23d2a4afdc5f300227be1fc5fb.tar.bz2 RoughlyEnoughItems-4ab17cd1d282dc23d2a4afdc5f300227be1fc5fb.zip | |
Basic Craftable Only
Diffstat (limited to 'src/main/java/me/shedaniel/impl')
| -rwxr-xr-x | src/main/java/me/shedaniel/impl/REIRecipeManager.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/me/shedaniel/impl/REIRecipeManager.java b/src/main/java/me/shedaniel/impl/REIRecipeManager.java index fbecbd6ac..2f5ed50c6 100755 --- a/src/main/java/me/shedaniel/impl/REIRecipeManager.java +++ b/src/main/java/me/shedaniel/impl/REIRecipeManager.java @@ -16,6 +16,7 @@ import java.awt.*; import java.util.*; import java.util.List; import java.util.function.Function; +import java.util.stream.Collectors; /** * Created by James on 8/7/2018. @@ -137,6 +138,7 @@ public class REIRecipeManager implements IRecipeManager { return categories; } + @Deprecated public List<IRecipe> findUsageForItems(List<ItemStack> types) { List<IRecipe> recipes = new ArrayList<>(); types.forEach(item -> { @@ -146,6 +148,30 @@ public class REIRecipeManager implements IRecipeManager { return recipes; } + public List<ItemStack> findCraftableByItems(List<ItemStack> types) { + List<ItemStack> craftables = new ArrayList<>(); + for(List<IRecipe> value : recipeList.values()) + for(IRecipe iRecipe : value) { + int slotsCraftable = 0; + for(List<ItemStack> slot : ((List<List<ItemStack>>) iRecipe.getRecipeRequiredInput())) { + boolean slotDone = false; + for(ItemStack possibleType : types) { + for(ItemStack slotPossible : slot) + if (ItemStack.areEqualIgnoreTags(slotPossible, possibleType)) { + slotsCraftable++; + slotDone = true; + break; + } + if (slotDone) + break; + } + } + if (slotsCraftable == iRecipe.getRecipeRequiredInput().size()) + craftables.addAll((List<ItemStack>) iRecipe.getOutput()); + } + return craftables.stream().distinct().collect(Collectors.toList()); + } + public List<IDisplayCategory> getAdatapersForOutput(ItemStack stack) { return null; } |
