/* * Roughly Enough Items by Danielshe. * Licensed under the MIT License. */ package me.shedaniel.rei.api; 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; public interface RecipeDisplay { /** * @return a list of items * @see RecipeDisplay#getInputStacks() */ @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 */ @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 Collections.emptyList(); } /** * Gets the recipe display category identifier * * @return the identifier of the category */ Identifier getRecipeCategory(); /** * Gets the recipe location from datapack * * @return the recipe location */ default Optional getRecipeLocation() { return Optional.empty(); } }