    001package net.minecraft.client.gui;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import net.minecraft.client.Minecraft;
    006import org.lwjgl.opengl.GL11;
    007
    008@SideOnly(Side.CLIENT)
    009public class GuiButtonMerchant extends GuiButton
    010{
    011    /**
    012     * If true, then next page button will face to right, if false then next page button will face to left.
    013     */
    014    private final boolean mirrored;
    015
    016    public GuiButtonMerchant(int par1, int par2, int par3, boolean par4)
    017    {
    018        super(par1, par2, par3, 12, 19, "");
    019        this.mirrored = par4;
    020    }
    021
    022    /**
    023     * Draws this button to the screen.
    024     */
    025    public void drawButton(Minecraft par1Minecraft, int par2, int par3)
    026    {
    027        if (this.drawButton)
    028        {
    029            GL11.glBindTexture(GL11.GL_TEXTURE_2D, par1Minecraft.renderEngine.getTexture("/gui/trading.png"));
    030            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    031            boolean var4 = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
    032            int var5 = 0;
    033            int var6 = 176;
    034
    035            if (!this.enabled)
    036            {
    037                var6 += this.width * 2;
    038            }
    039            else if (var4)
    040            {
    041                var6 += this.width;
    042            }
    043
    044            if (!this.mirrored)
    045            {
    046                var5 += this.height;
    047            }
    048
    049            this.drawTexturedModalRect(this.xPosition, this.yPosition, var6, var5, this.width, this.height);
    050        }
    051    }
    052}