diff options
Diffstat (limited to 'src/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java')
| -rwxr-xr-x | src/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java b/src/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java new file mode 100755 index 000000000..1c537b2a7 --- /dev/null +++ b/src/main/java/me/shedaniel/plugin/crafting/VanillaShapedCraftingRecipe.java @@ -0,0 +1,55 @@ +package me.shedaniel.plugin.crafting; + +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; +import net.minecraft.item.crafting.ShapedRecipe; + +import java.util.LinkedList; +import java.util.List; + +public class VanillaShapedCraftingRecipe extends VanillaCraftingRecipe { + + private final ShapedRecipe recipe; + + public VanillaShapedCraftingRecipe(ShapedRecipe recipe) { + + this.recipe = recipe; + } + + @Override + public int getWidth() { + return recipe.getWidth(); + } + + @Override + public int getHeight() { + return recipe.getHeight(); + } + + @Override + public String getId() { + return "vanilla"; + } + + @Override + public List<ItemStack> getOutput() { + List<ItemStack> output = new LinkedList<>(); + output.add(recipe.getRecipeOutput()); + return output; + } + + @Override + public List<List<ItemStack>> getInput() { + List<List<ItemStack>> input = new LinkedList<>(); + int count = 0; + for(Ingredient ingredient : recipe.getIngredients()) { + List<ItemStack> ingList = new LinkedList<>(); + for(ItemStack matchingStack : ingredient.getMatchingStacks()) { + ingList.add(matchingStack); + } + input.add(ingList); + count++; + } + return input; + } +} |
