/
BrewingRecipeCategory.java
89 lines (71 loc) · 3.08 KB
/
BrewingRecipeCategory.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package mezz.jei.plugins.vanilla.brewing;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IDrawableAnimated;
import mezz.jei.api.gui.IDrawableStatic;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import mezz.jei.util.Translator;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class BrewingRecipeCategory extends BlankRecipeCategory<BrewingRecipeWrapper> {
private static final int brewPotionSlot1 = 0;
private static final int brewPotionSlot2 = 1;
private static final int brewPotionSlot3 = 2;
private static final int brewIngredientSlot = 3;
private static final int outputSlot = 4; // for display only
private static final int outputSlotX = 80;
private static final int outputSlotY = 1;
private final IDrawable background;
private final IDrawable slotDrawable;
private final String localizedName;
private final IDrawableAnimated arrow;
private final IDrawableAnimated bubbles;
private final IDrawableStatic blazeHeat;
public BrewingRecipeCategory(IGuiHelper guiHelper) {
ResourceLocation location = new ResourceLocation("minecraft", "textures/gui/container/brewing_stand.png");
background = guiHelper.createDrawable(location, 55, 15, 64, 60, 0, 0, 0, 40);
localizedName = Translator.translateToLocal("gui.jei.category.brewing");
IDrawableStatic brewArrowDrawable = guiHelper.createDrawable(location, 176, 0, 9, 28);
arrow = guiHelper.createAnimatedDrawable(brewArrowDrawable, 400, IDrawableAnimated.StartDirection.TOP, false);
IDrawableStatic brewBubblesDrawable = guiHelper.createDrawable(location, 185, 1, 12, 28);
bubbles = guiHelper.createAnimatedDrawable(brewBubblesDrawable, 20, IDrawableAnimated.StartDirection.BOTTOM, false);
blazeHeat = guiHelper.createDrawable(location, 176, 29, 18, 4);
slotDrawable = guiHelper.getSlotDrawable();
}
@Override
public String getUid() {
return VanillaRecipeCategoryUid.BREWING;
}
@Override
public String getTitle() {
return localizedName;
}
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(Minecraft minecraft) {
slotDrawable.draw(minecraft, outputSlotX, outputSlotY);
blazeHeat.draw(minecraft, 5, 29);
}
@Override
public void drawAnimations(Minecraft minecraft) {
bubbles.draw(minecraft, 8, 0);
arrow.draw(minecraft, 42, 1);
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, BrewingRecipeWrapper recipeWrapper, IIngredients ingredients) {
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(brewPotionSlot1, true, 0, 35);
itemStacks.init(brewPotionSlot2, true, 23, 42);
itemStacks.init(brewPotionSlot3, true, 46, 35);
itemStacks.init(brewIngredientSlot, true, 23, 1);
itemStacks.init(outputSlot, false, outputSlotX, outputSlotY);
itemStacks.set(ingredients);
}
}