mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-13 08:54:12 +00:00
55 lines
1.9 KiB
Java
55 lines
1.9 KiB
Java
package tconstruct.client.gui;
|
|||
|
|
|
||
|
|
import net.minecraft.client.Minecraft;
|
||
|
|
import net.minecraft.client.gui.GuiButton;
|
||
|
|
import net.minecraft.util.ResourceLocation;
|
||
|
|
|
||
|
|
import org.lwjgl.opengl.GL11;
|
||
|
|
|
||
|
|
import tconstruct.library.client.ToolGuiElement;
|
||
|
|
|
||
|
|
|
||
|
|
import cpw.mods.fml.relauncher.Side;
|
||
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
||
|
|
|
||
|
|
@SideOnly(Side.CLIENT)
|
||
|
|
public class GuiButtonTool extends GuiButton
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* True for pointing right (next page), false for pointing left (previous page).
|
||
|
|
*/
|
||
|
|
int textureX;
|
||
|
|
int textureY;
|
||
|
|
public String texture;
|
||
|
|
public ToolGuiElement element;
|
||
|
|
private static ResourceLocation background;// = new ResourceLocation("tinker", "textures/gui/armorextended.png");
|
||
|
|
|
||
|
|
public GuiButtonTool(int id, int posX, int posY, int texX, int texY, String domain, String tex, ToolGuiElement e)
|
||
|
|
{
|
||
|
|
super(id, posX, posY, 18, 18, "");
|
||
|
|
textureX = texX;
|
||
|
|
textureY = texY;
|
||
|
|
texture = tex;
|
||
|
|
element = e;
|
||
|
|
background = new ResourceLocation(domain, tex);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Draws this button to the screen.
|
||
|
|
*/
|
||
|
|
public void drawButton (Minecraft mc, int mouseX, int mouseY)
|
||
|
|
{
|
||
|
|
if (this.drawButton)
|
||
|
|
{
|
||
|
|
boolean var4 = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||
|
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||
|
|
mc.func_110434_K().func_110577_a(background);
|
||
|
|
|
||
|
|
this.field_82253_i = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||
|
|
int var5 = this.getHoverState(this.field_82253_i);
|
||
|
|
int index = 18 * getHoverState(field_82253_i);
|
||
|
|
this.drawTexturedModalRect(this.xPosition, this.yPosition, 144 + index * 2, 216, 18, 18);
|
||
|
|
this.drawTexturedModalRect(this.xPosition, this.yPosition, textureX * 18, textureY * 18, 18, 18);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|