You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
2.2 KiB
Java
45 lines
2.2 KiB
Java
package net.brokenmoon.afloydwiremod.gui;
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.src.FontRenderer;
|
|
import net.minecraft.src.GuiButton;
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
public class GuiButtonExtended extends GuiButton {
|
|
|
|
public String type;
|
|
public int slot;
|
|
public int scroll;
|
|
public static final int width = 80;
|
|
public static final int height = 10;
|
|
public GuiButtonExtended(int id, int xPosition, String s, String extra, int slot) {
|
|
super(id, xPosition / 2 - (width / 2), 50 - height + (height * (id + 1)), width, height, s);
|
|
this.type = extra;
|
|
this.slot = slot;
|
|
}
|
|
public GuiButtonExtended(int id, int xPosition, String s) {
|
|
super(id, xPosition / 2 - (width / 2), 50 - height + (height * (id + 1)), width, height, s);
|
|
}
|
|
@Override
|
|
public void drawButton(Minecraft minecraft, int i, int j) {
|
|
if (!this.visible) {
|
|
return;
|
|
}
|
|
FontRenderer fontrenderer = minecraft.fontRenderer;
|
|
GL11.glBindTexture(3553, minecraft.renderEngine.getTexture("/gui/gui.png"));
|
|
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
|
boolean flag = i >= this.xPosition && j >= this.yPosition + scroll && i < this.xPosition + this.width && j < this.yPosition + scroll + this.height;
|
|
int k = this.getButtonState(flag);
|
|
this.drawTexturedModalRect(this.xPosition, this.yPosition + scroll, 0, 46 + k * 20, this.width / 2, this.height);
|
|
this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition + scroll, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height);
|
|
this.mouseDragged(minecraft, i, j);
|
|
if (!this.enabled) {
|
|
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2 + scroll, -6250336);
|
|
} else if (flag) {
|
|
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2 + scroll, 0xFFFFA0);
|
|
} else {
|
|
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2 + scroll, 0xE0E0E0);
|
|
}
|
|
}
|
|
}
|