aether-legacy/src/main/java/com/gildedgames/the_aether/client/gui/button/GuiLoreButton.java
2020-08-13 23:29:22 -07:00

48 lines
1.9 KiB
Java

package com.gildedgames.the_aether.client.gui.button;
import com.gildedgames.the_aether.Aether;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class GuiLoreButton extends GuiButton {
protected static final ResourceLocation BUTTON_TEXTURES = Aether.locate("textures/gui/lore_widgets.png");
public GuiLoreButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText) {
super(buttonId, x, y, widthIn, heightIn, buttonText);
}
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.visible) {
FontRenderer fontrenderer = mc.fontRenderer;
mc.getTextureManager().bindTexture(BUTTON_TEXTURES);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
int i = this.getHoverState(this.field_146123_n);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + i * 20, this.width / 2, this.height);
this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
this.mouseDragged(mc, mouseX, mouseY);
int j = 14737632;
if (this.packedFGColour != 0) {
j = this.packedFGColour;
} else if (!this.enabled) {
j = 10526880;
} else if (this.field_146123_n) {
j = 16777120;
}
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, j);
}
}
}