aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/plugin/smithing/DefaultSmithingDisplay.java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2020-06-19 15:12:37 +0800
committershedaniel <daniel@shedaniel.me>2020-06-19 15:12:37 +0800
commit463197999f1711ffd453b7246bdc580f9dde3390 (patch)
tree2fb28fcb7460465bfa5c230a0628bd26e6ca19b6 /src/main/java/me/shedaniel/rei/plugin/smithing/DefaultSmithingDisplay.java
parent83b53bec070bd595ea8118b6a68979c0b5a180ed (diff)
downloadRoughlyEnoughItems-463197999f1711ffd453b7246bdc580f9dde3390.tar.gz
RoughlyEnoughItems-463197999f1711ffd453b7246bdc580f9dde3390.tar.bz2
RoughlyEnoughItems-463197999f1711ffd453b7246bdc580f9dde3390.zip
Add smithing recipes, close #352
Signed-off-by: shedaniel <daniel@shedaniel.me>
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;
+ }
+}