diff options
| author | Unknown <shekwancheung0528@gmail.com> | 2019-08-18 17:02:08 +0800 |
|---|---|---|
| committer | Unknown <shekwancheung0528@gmail.com> | 2019-08-18 17:02:08 +0800 |
| commit | b6f36732c933c6d406d730e11cd3b7ed390b95ae (patch) | |
| tree | ea7f7ee385a313c45ba2e5ef6371b4f2eaeea322 /src/main/java/me/shedaniel/rei/gui/widget/RecipeArrowWidget.java | |
| parent | b65de8ed7fe045df451130e3c790613c4f002e2c (diff) | |
| download | RoughlyEnoughItems-b6f36732c933c6d406d730e11cd3b7ed390b95ae.tar.gz RoughlyEnoughItems-b6f36732c933c6d406d730e11cd3b7ed390b95ae.tar.bz2 RoughlyEnoughItems-b6f36732c933c6d406d730e11cd3b7ed390b95ae.zip | |
Speed Craft -> Auto Craft
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/widget/RecipeArrowWidget.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/gui/widget/RecipeArrowWidget.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/main/java/me/shedaniel/rei/gui/widget/RecipeArrowWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/RecipeArrowWidget.java new file mode 100644 index 000000000..daecf8e8a --- /dev/null +++ b/src/main/java/me/shedaniel/rei/gui/widget/RecipeArrowWidget.java @@ -0,0 +1,46 @@ +package me.shedaniel.rei.gui.widget; + +import com.mojang.blaze3d.platform.GlStateManager; +import me.shedaniel.math.api.Rectangle; +import me.shedaniel.rei.plugin.DefaultPlugin; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.Element; +import net.minecraft.client.render.GuiLighting; +import net.minecraft.util.math.MathHelper; + +import java.util.Collections; +import java.util.List; + +public class RecipeArrowWidget extends WidgetWithBounds { + + private int x, y; + private boolean animated; + + public RecipeArrowWidget(int x, int y, boolean animated) { + this.x = x; + this.y = y; + this.animated = animated; + } + + @Override + public Rectangle getBounds() { + return new Rectangle(x, y, 24, 17); + } + + @Override + public void render(int mouseX, int mouseY, float delta) { + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiLighting.disable(); + MinecraftClient.getInstance().getTextureManager().bindTexture(DefaultPlugin.getDisplayTexture()); + blit(x, y, 106, 91, 24, 17); + if (animated) { + int width = MathHelper.ceil((System.currentTimeMillis() / 250 % 24d) / 1f); + blit(x, y, 82, 91, width, 17); + } + } + + @Override + public List<? extends Element> children() { + return Collections.emptyList(); + } +} |
