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
|
package me.shedaniel.gui.widget;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.util.ResourceLocation;
public class WidgetArrow extends Control {
private static final ResourceLocation RECIPE_GUI = new ResourceLocation("almostenoughitems", "textures/gui/recipecontainer.png");
private int progress = 0;
private int updateTick = 0;
private boolean animated;
public WidgetArrow(int x, int y, boolean animated) {
super(x, y, 22, 18);
this.animated = animated;
}
@Override
public void draw() {
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderHelper.disableStandardItemLighting();
Minecraft.getInstance().getTextureManager().bindTexture(RECIPE_GUI);
this.drawTexturedModalRect(rect.x, rect.y, 18, 222, 22, 18);
if (animated) {
int width = (int) ((progress / 10f) * 22);
this.drawTexturedModalRect(rect.x - 1, rect.y - 1, 40, 222, width, 18);
}
}
@Override
public void tick() {
updateTick++;
if (updateTick >= 20) {
updateTick = 0;
progress++;
if (progress > 10)
progress = 0;
}
}
}
|