Search in sources :

Example 1 with ToolTip

use of mods.railcraft.common.gui.tooltips.ToolTip in project Railcraft by Railcraft.

the class GuiTradeStation method initGui.

@Override
public void initGui() {
    super.initGui();
    buttonList.clear();
    int w = (width - xSize) / 2;
    int h = (height - ySize) / 2;
    buttonList.add(new GuiSimpleButton(0, w + 118, h + 64, 10, StandardButtonTextureSets.LEFT_BUTTON, ""));
    buttonList.add(new GuiSimpleButton(1, w + 156, h + 64, 10, StandardButtonTextureSets.RIGHT_BUTTON, ""));
    GuiSimpleButton[] dice = new GuiSimpleButton[3];
    ToolTip tip = ToolTip.buildToolTip("gui.railcraft.trade.station.dice.tips");
    if (tip != null)
        tip.get(0).format = TextFormatting.YELLOW;
    for (int b = 0; b < 3; b++) {
        dice[b] = new GuiSimpleButton(2 + b, w + 93, h + 24 + 21 * b, 16, StandardButtonTextureSets.DICE_BUTTON, "");
        dice[b].setToolTip(tip);
        buttonList.add(dice[b]);
    }
}
Also used : ToolTip(mods.railcraft.common.gui.tooltips.ToolTip) GuiSimpleButton(mods.railcraft.client.gui.buttons.GuiSimpleButton)

Example 2 with ToolTip

use of mods.railcraft.common.gui.tooltips.ToolTip in project Railcraft by Railcraft.

the class ItemWorldspike method getToolTip.

@Override
public ToolTip getToolTip(ItemStack stack, EntityPlayer player, boolean adv) {
    ToolTip tips = super.getToolTip(stack, player, adv);
    WorldspikeVariant variant = (WorldspikeVariant) getVariant(stack);
    if (variant != null && !variant.getFuelList().isEmpty()) {
        tips = addFuelInfo(tips, stack);
    }
    return tips;
}
Also used : ToolTip(mods.railcraft.common.gui.tooltips.ToolTip)

Example 3 with ToolTip

use of mods.railcraft.common.gui.tooltips.ToolTip in project Railcraft by Railcraft.

the class ItemOveralls method addInformation.

@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> info, boolean adv) {
    super.addInformation(stack, player, info, adv);
    ToolTip tip = ToolTip.buildToolTip(stack.getUnlocalizedName() + ".tips");
    if (tip != null)
        info.addAll(tip.convertToStrings());
}
Also used : ToolTip(mods.railcraft.common.gui.tooltips.ToolTip)

Example 4 with ToolTip

use of mods.railcraft.common.gui.tooltips.ToolTip 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)

Example 5 with ToolTip

use of mods.railcraft.common.gui.tooltips.ToolTip in project Railcraft by Railcraft.

the class ItemCart method addInformation.

@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> info, boolean adv) {
    super.addInformation(stack, player, info, adv);
    ToolTip tip = ToolTip.buildToolTip(stack.getUnlocalizedName() + ".tips");
    if (tip != null)
        info.addAll(tip.convertToStrings());
    ItemStack filter = CartBaseFiltered.getFilterFromCartItem(stack);
    if (!InvTools.isEmpty(filter)) {
        info.add(TextFormatting.BLUE + LocalizationPlugin.translate("gui.railcraft.filter") + ": " + filter.getDisplayName());
    }
}
Also used : ToolTip(mods.railcraft.common.gui.tooltips.ToolTip) ItemStack(net.minecraft.item.ItemStack)

Aggregations

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