aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/plugin/potion/VanillaPotionRecipe.java
blob: 3f4592a90fe89296f72f9923c9f419183d293d48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package me.shedaniel.plugin.potion;

import me.shedaniel.api.IRecipe;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

public class VanillaPotionRecipe implements IRecipe<ItemStack> {
    
    private ItemStack[] input, reactWith, output;
    
    @Override
    public String getId() {
        return "potion";
    }
    
    public VanillaPotionRecipe(ItemStack[] input, ItemStack[] reactWith, ItemStack[] output) {
        this.input = input;
        this.reactWith = reactWith;
        this.output = output;
    }
    
    @Override
    public List<ItemStack> getOutput() {
        return Arrays.asList(output);
    }
    
    @Override
    public List<List<ItemStack>> getInput() {
        List<List<ItemStack>> input = new LinkedList<>();
        input.add(new ArrayList<>(Arrays.asList(this.input)));
        input.add(new ArrayList<>(Arrays.asList(this.reactWith)));
        return input;
    }
    
    public List<ItemStack> getOutput(int slot) {
        List<ItemStack> stack = new ArrayList<>();
        for(int i = 0; i < slot * 2; i++)
            stack.add(new ItemStack(Blocks.AIR));
        for(int i = 0; i < 6 - slot * 2; i++)
            stack.addAll(getOutput());
        return stack;
    }
}