/
CauldronDyeRecipe.java
54 lines (44 loc) · 1.42 KB
/
CauldronDyeRecipe.java
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
49
50
51
52
53
54
package knightminer.inspirations.library.recipe.cauldron;
import javax.annotation.ParametersAreNonnullByDefault;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemStack;
import slimeknights.mantle.util.RecipeMatch;
/**
* Cauldron recipe to dye an item stack from colored cauldron water
*/
@ParametersAreNonnullByDefault
public class CauldronDyeRecipe extends CauldronRecipeMatchRecipe {
private EnumDyeColor color;
/**
* @param input Input recipe match entry
* @param color Color to test for in the cauldron
* @param result Resulting item stack
*/
public CauldronDyeRecipe(RecipeMatch input, EnumDyeColor color, ItemStack result, int levels) {
super(input, result, null, levels);
this.color = color;
}
public CauldronDyeRecipe(RecipeMatch input, EnumDyeColor color, ItemStack result) {
this(input, color, result, 1);
}
/**
* @param input Input item stack
* @param color Color to test for in the cauldron
* @param result Resulting item stack
*/
public CauldronDyeRecipe(ItemStack input, EnumDyeColor color, ItemStack result) {
this(RecipeMatch.of(input), color, result);
}
@Override
protected boolean matches(CauldronState state) {
return state.getColor() == color.colorValue;
}
@Override
public Object getInputState() {
return color;
}
@Override
public String toString() {
return String.format("CauldronDyeRecipe: %s dyed %s", getResult().toString(), color.getName());
}
}