From 9f5a9eae9a7863412cc5eb433bf15e5ee71da616 Mon Sep 17 00:00:00 2001 From: Danielshe Date: Sun, 3 Nov 2019 14:44:52 +0800 Subject: 3.2.1 --- .../rei/plugin/crafting/DefaultShapedDisplay.java | 28 +++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'src/main/java/me/shedaniel/rei/plugin/crafting/DefaultShapedDisplay.java') 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> input; - private List output; + private List> input; + private List 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 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> getInput() { + public List> getInputEntries() { return input; } @Override - public List getOutput() { + public List getOutputEntries() { return output; } @Override - public List> getRequiredItems() { + public List> getRequiredEntries() { return input; } -- cgit