aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/plugin/smithing/DefaultSmithingDisplay.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/shedaniel/rei/plugin/smithing/DefaultSmithingDisplay.java')
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/smithing/DefaultSmithingDisplay.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/main/java/me/shedaniel/rei/plugin/smithing/DefaultSmithingDisplay.java b/src/main/java/me/shedaniel/rei/plugin/smithing/DefaultSmithingDisplay.java
new file mode 100644
index 000000000..0fff256f6
--- /dev/null
+++ b/src/main/java/me/shedaniel/rei/plugin/smithing/DefaultSmithingDisplay.java
@@ -0,0 +1,51 @@
+package me.shedaniel.rei.plugin.smithing;
+
+import com.google.common.collect.Lists;
+import me.shedaniel.rei.api.EntryStack;
+import me.shedaniel.rei.api.RecipeDisplay;
+import me.shedaniel.rei.plugin.DefaultPlugin;
+import me.shedaniel.rei.utils.CollectionUtils;
+import net.minecraft.recipe.SmithingRecipe;
+import net.minecraft.util.Identifier;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collections;
+import java.util.List;
+
+public class DefaultSmithingDisplay implements RecipeDisplay {
+ @NotNull
+ private List<List<EntryStack>> input;
+ @NotNull
+ private List<EntryStack> output;
+
+ public DefaultSmithingDisplay(@NotNull SmithingRecipe recipe) {
+ this(
+ Lists.newArrayList(
+ CollectionUtils.map(recipe.base.getMatchingStacksClient(), EntryStack::create),
+ CollectionUtils.map(recipe.addition.getMatchingStacksClient(), EntryStack::create)
+ ),
+ Collections.singletonList(EntryStack.create(recipe.getOutput()))
+ );
+ }
+
+ public DefaultSmithingDisplay(@NotNull List<List<EntryStack>> input, @NotNull List<EntryStack> output) {
+ this.input = input;
+ this.output = output;
+ if (this.input.size() != 2) throw new IllegalArgumentException("input must have 2 entries.");
+ }
+
+ @Override
+ public List<List<EntryStack>> getInputEntries() {
+ return input;
+ }
+
+ @Override
+ public List<EntryStack> getOutputEntries() {
+ return output;
+ }
+
+ @Override
+ public Identifier getRecipeCategory() {
+ return DefaultPlugin.SMITHING;
+ }
+}