package ru.betterend.compat; import java.util.Collections; import java.util.List; import java.util.Optional; import org.jetbrains.annotations.NotNull; import me.shedaniel.rei.api.EntryStack; import me.shedaniel.rei.api.TransferRecipeDisplay; import me.shedaniel.rei.server.ContainerInfo; import net.minecraft.recipe.Recipe; import net.minecraft.screen.ScreenHandler; import net.minecraft.util.Identifier; import ru.betterend.recipe.AnvilSmithingRecipe; public class REIAnvilDisplay implements TransferRecipeDisplay { private AnvilSmithingRecipe recipe; private List> input; private List output; public REIAnvilDisplay(AnvilSmithingRecipe recipe) { this.recipe = recipe; this.input = EntryStack.ofIngredients(recipe.getPreviewInputs()); this.output = Collections.singletonList(EntryStack.create(recipe.getOutput())); } public int getDamage() { return this.recipe.getDamage(); } @Override public @NotNull Optional getRecipeLocation() { return Optional.ofNullable(recipe).map(Recipe::getId); } @Override public @NotNull List> getInputEntries() { return this.input; } @Override public @NotNull List> getResultingEntries() { return Collections.singletonList(output); } @Override public @NotNull Identifier getRecipeCategory() { return REIPlugin.SMITHING; } @Override public @NotNull List> getRequiredEntries() { return this.input; } @Override public int getWidth() { return 2; } @Override public int getHeight() { return 1; } @Override public List> getOrganisedInputEntries(ContainerInfo containerInfo, ScreenHandler container) { return this.input; } }