Search in sources :

Example 1 with GuiBetterButton

use of mods.railcraft.client.gui.buttons.GuiBetterButton in project Railcraft by Railcraft.

the class GuiContainerRailcraft method drawScreen.

/**
     * Draws the screen and all the components in it.
     */
@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
    super.drawScreen(mouseX, mouseY, par3);
    int left = guiLeft;
    int top = guiTop;
    OpenGL.glDisable(GL11.GL_LIGHTING);
    OpenGL.glDisable(GL11.GL_DEPTH_TEST);
    OpenGL.glPushMatrix();
    OpenGL.glTranslatef((float) left, (float) top, 0.0F);
    OpenGL.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    RenderHelper.disableStandardItemLighting();
    InventoryPlayer playerInv = mc.thePlayer.inventory;
    if (playerInv.getItemStack() == null) {
        int mX = mouseX - left;
        int mY = mouseY - top;
        for (Widget element : container.getWidgets()) {
            if (element.hidden)
                continue;
            ToolTip tips = element.getToolTip();
            if (tips == null)
                continue;
            boolean mouseOver = element.isMouseOver(mX, mY);
            tips.onTick(mouseOver);
            if (mouseOver && tips.isReady()) {
                tips.refresh();
                drawToolTips(tips, mouseX, mouseY);
            }
        }
        for (Object button : buttonList) {
            if (!(button instanceof GuiBetterButton))
                continue;
            GuiBetterButton betterButton = (GuiBetterButton) button;
            if (!betterButton.visible)
                continue;
            ToolTip tips = betterButton.getToolTip();
            if (tips == null)
                continue;
            boolean mouseOver = betterButton.isMouseOverButton(mouseX, mouseY);
            tips.onTick(mouseOver);
            if (mouseOver && tips.isReady()) {
                tips.refresh();
                drawToolTips(tips, mouseX, mouseY);
            }
        }
        for (Object obj : inventorySlots.inventorySlots) {
            if (!(obj instanceof SlotRailcraft))
                continue;
            SlotRailcraft slot = (SlotRailcraft) obj;
            if (slot.getStack() != null)
                continue;
            ToolTip tips = slot.getToolTip();
            if (tips == null)
                continue;
            boolean mouseOver = isMouseOverSlot(slot, mouseX, mouseY);
            tips.onTick(mouseOver);
            if (mouseOver && tips.isReady()) {
                tips.refresh();
                drawToolTips(tips, mouseX, mouseY);
            }
        }
    }
    OpenGL.glPopMatrix();
    OpenGL.glEnable(GL11.GL_LIGHTING);
    OpenGL.glEnable(GL11.GL_DEPTH_TEST);
}
Also used : ToolTip(mods.railcraft.common.gui.tooltips.ToolTip) InventoryPlayer(net.minecraft.entity.player.InventoryPlayer) GuiBetterButton(mods.railcraft.client.gui.buttons.GuiBetterButton) Widget(mods.railcraft.common.gui.widgets.Widget) SlotRailcraft(mods.railcraft.common.gui.slots.SlotRailcraft)

Aggregations

GuiBetterButton (mods.railcraft.client.gui.buttons.GuiBetterButton)1 SlotRailcraft (mods.railcraft.common.gui.slots.SlotRailcraft)1 ToolTip (mods.railcraft.common.gui.tooltips.ToolTip)1 Widget (mods.railcraft.common.gui.widgets.Widget)1 InventoryPlayer (net.minecraft.entity.player.InventoryPlayer)1