From 9f5a9eae9a7863412cc5eb433bf15e5ee71da616 Mon Sep 17 00:00:00 2001 From: Danielshe Date: Sun, 3 Nov 2019 14:44:52 +0800 Subject: 3.2.1 --- .../java/me/shedaniel/rei/api/RecipeDisplay.java | 68 ++++++++++++++++++++-- 1 file changed, 64 insertions(+), 4 deletions(-) (limited to 'src/main/java/me/shedaniel/rei/api/RecipeDisplay.java') diff --git a/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java b/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java index 693712fc6..dd563f01a 100644 --- a/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java +++ b/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java @@ -5,10 +5,12 @@ package me.shedaniel.rei.api; -import com.google.common.collect.Lists; +import me.shedaniel.rei.api.annotations.ToBeRemoved; import net.minecraft.item.ItemStack; import net.minecraft.util.Identifier; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Optional; @@ -16,21 +18,79 @@ public interface RecipeDisplay { /** * @return a list of items + * @see RecipeDisplay#getInputStacks() */ - List> getInput(); + @ToBeRemoved + @Deprecated + default List> getInput() { + return Collections.emptyList(); + } + + /** + * @return a list of inputs + */ + default List> getInputEntries() { + List> input = getInput(); + if (input.isEmpty()) + return Collections.emptyList(); + List> list = new ArrayList<>(); + for (List stacks : input) { + List entries = new ArrayList<>(); + for (ItemStack stack : stacks) { + entries.add(EntryStack.create(stack)); + } + list.add(entries); + } + return list; + } /** * @return a list of outputs */ - List getOutput(); + @ToBeRemoved + @Deprecated + default List getOutput() { + return Collections.emptyList(); + } + + /** + * @return a list of outputs + */ + default List getOutputEntries() { + List input = getOutput(); + if (input.isEmpty()) + return Collections.emptyList(); + List entries = new ArrayList<>(); + for (ItemStack stack : input) { + entries.add(EntryStack.create(stack)); + } + return entries; + } /** * Gets the required items used in craftable filters * * @return the list of required items */ + default List> getRequiredEntries() { + List> input = getRequiredItems(); + if (input.isEmpty()) + return Collections.emptyList(); + List> list = new ArrayList<>(); + for (List stacks : input) { + List entries = new ArrayList<>(); + for (ItemStack stack : stacks) { + entries.add(EntryStack.create(stack)); + } + list.add(entries); + } + return list; + } + + @ToBeRemoved + @Deprecated default List> getRequiredItems() { - return Lists.newArrayList(); + return Collections.emptyList(); } /** -- cgit