/
RecipeArrowTab.java
52 lines (44 loc) · 1.41 KB
/
RecipeArrowTab.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
package mezz.jei.gui.recipes;
import javax.annotation.Nullable;
import mezz.jei.api.recipe.IRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager;
public class RecipeArrowTab extends RecipeGuiTab {
private final RecipeGuiTabs recipeGuiTabs;
private final boolean next;
public RecipeArrowTab(RecipeGuiTabs recipeGuiTabs, boolean next, int x, int y) {
super(x, y);
this.recipeGuiTabs = recipeGuiTabs;
this.next = next;
}
@Override
public void draw(Minecraft minecraft, boolean selected, int mouseX, int mouseY) {
super.draw(minecraft, selected, mouseX, mouseY);
String arrow = next ? ">" : "<";
FontRenderer fontRenderer = minecraft.fontRendererObj;
float textCenterX = x + (TAB_WIDTH / 2f);
float textCenterY = y + (TAB_HEIGHT / 2f) - 3;
int color = isMouseOver(mouseX, mouseY) ? 16777120 : 14737632;
fontRenderer.drawStringWithShadow(arrow, textCenterX - fontRenderer.getStringWidth(arrow) / 2f, textCenterY, color);
GlStateManager.color(1, 1, 1, 1);
}
@Override
public boolean handleMouseClicked(int mouseX, int mouseY, int mouseButton) {
if (next) {
recipeGuiTabs.nextPage();
} else {
recipeGuiTabs.prevPage();
}
return true;
}
@Override
public boolean isSelected(IRecipeCategory selectedCategory) {
return false;
}
@Nullable
@Override
public String getTooltip() {
return null;
}
}