diff options
| author | Danielshe <shekwancheung0528@gmail.com> | 2019-11-03 14:44:52 +0800 |
|---|---|---|
| committer | Danielshe <shekwancheung0528@gmail.com> | 2019-11-03 14:44:59 +0800 |
| commit | 9f5a9eae9a7863412cc5eb433bf15e5ee71da616 (patch) | |
| tree | 0e6b0b94af061c5e9023b1ff19f339a6c30149be /src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapedDisplay.java | |
| parent | 3e3e25855b9f6df507a7d4c8a07c64b9a502fae2 (diff) | |
| download | RoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.tar.gz RoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.tar.bz2 RoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.zip | |
3.2.1
Diffstat (limited to 'src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapedDisplay.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapedDisplay.java | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapedDisplay.java b/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapedDisplay.java index f82a858f5..c14b18e53 100644 --- a/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapedDisplay.java +++ b/src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapedDisplay.java @@ -5,12 +5,14 @@ package me.shedaniel.rei.plugin.crafting; +import me.shedaniel.rei.api.EntryStack; import net.minecraft.item.ItemStack; +import net.minecraft.item.PotionItem; import net.minecraft.recipe.Recipe; import net.minecraft.recipe.ShapedRecipe; import net.minecraft.util.Identifier; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Optional; @@ -19,13 +21,23 @@ import java.util.stream.Collectors; public class DefaultShapedDisplay implements DefaultCraftingDisplay { private ShapedRecipe display; - private List<List<ItemStack>> input; - private List<ItemStack> output; + private List<List<EntryStack>> input; + private List<EntryStack> output; public DefaultShapedDisplay(ShapedRecipe recipe) { this.display = recipe; - this.input = recipe.getPreviewInputs().stream().map(i -> Arrays.asList(i.getMatchingStacksClient())).collect(Collectors.toList()); - this.output = Collections.singletonList(recipe.getOutput()); + this.input = recipe.getPreviewInputs().stream().map(i -> { + List<EntryStack> entries = new ArrayList<>(); + for (ItemStack stack : i.getStackArray()) { + if (stack.getItem() instanceof PotionItem) + entries.add(EntryStack.create(stack).setting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE)); + else entries.add(EntryStack.create(stack)); + } + return entries; + }).collect(Collectors.toList()); + if (recipe.getOutput().getItem() instanceof PotionItem) + this.output = Collections.singletonList(EntryStack.create(recipe.getOutput()).setting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE)); + else this.output = Collections.singletonList(EntryStack.create(recipe.getOutput())); } @Override @@ -34,17 +46,17 @@ public class DefaultShapedDisplay implements DefaultCraftingDisplay { } @Override - public List<List<ItemStack>> getInput() { + public List<List<EntryStack>> getInputEntries() { return input; } @Override - public List<ItemStack> getOutput() { + public List<EntryStack> getOutputEntries() { return output; } @Override - public List<List<ItemStack>> getRequiredItems() { + public List<List<EntryStack>> getRequiredEntries() { return input; } |
