Search in sources :

Example 1 with ToolTipLine

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

the class StandardTank method refreshTooltip.

protected void refreshTooltip() {
    toolTip.clear();
    int amount = getFluidAmount();
    FluidStack fluidStack = getFluid();
    if (!Fluids.isEmpty(fluidStack)) {
        toolTip.add(getFluidNameToolTip(fluidStack.getFluid()));
    }
    toolTip.add(new ToolTipLine(String.format(Locale.ENGLISH, "%,d / %,d", amount, getCapacity())));
}
Also used : ToolTipLine(mods.railcraft.common.gui.tooltips.ToolTipLine) FluidStack(net.minecraftforge.fluids.FluidStack)

Example 2 with ToolTipLine

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

the class StandardTank method getFluidNameToolTip.

protected ToolTipLine getFluidNameToolTip(Fluid fluid) {
    EnumRarity rarity = fluid.getRarity();
    if (rarity == null)
        rarity = EnumRarity.COMMON;
    ToolTipLine fluidName = new ToolTipLine(fluid.getLocalizedName(getFluid()), rarity.rarityColor);
    fluidName.setSpacing(2);
    return fluidName;
}
Also used : EnumRarity(net.minecraft.item.EnumRarity) ToolTipLine(mods.railcraft.common.gui.tooltips.ToolTipLine)

Example 3 with ToolTipLine

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

the class GuiContainerRailcraft method drawToolTips.

private void drawToolTips(ToolTip toolTips, int mouseX, int mouseY) {
    if (toolTips.size() > 0) {
        int left = guiLeft;
        int top = guiTop;
        int length = 0;
        int x;
        int y;
        for (ToolTipLine tip : toolTips) {
            y = fontRendererObj.getStringWidth(tip.text);
            if (y > length)
                length = y;
        }
        x = mouseX - left + 12;
        y = mouseY - top - 12;
        int var14 = 8;
        if (toolTips.size() > 1)
            var14 += 2 + (toolTips.size() - 1) * 10;
        this.zLevel = 300.0F;
        itemRender.zLevel = 300.0F;
        int var15 = -267386864;
        drawGradientRect(x - 3, y - 4, x + length + 3, y - 3, var15, var15);
        drawGradientRect(x - 3, y + var14 + 3, x + length + 3, y + var14 + 4, var15, var15);
        drawGradientRect(x - 3, y - 3, x + length + 3, y + var14 + 3, var15, var15);
        drawGradientRect(x - 4, y - 3, x - 3, y + var14 + 3, var15, var15);
        drawGradientRect(x + length + 3, y - 3, x + length + 4, y + var14 + 3, var15, var15);
        int var16 = 1347420415;
        int var17 = (var16 & 16711422) >> 1 | var16 & -16777216;
        drawGradientRect(x - 3, y - 3 + 1, x - 3 + 1, y + var14 + 3 - 1, var16, var17);
        drawGradientRect(x + length + 2, y - 3 + 1, x + length + 3, y + var14 + 3 - 1, var16, var17);
        drawGradientRect(x - 3, y - 3, x + length + 3, y - 3 + 1, var16, var16);
        drawGradientRect(x - 3, y + var14 + 2, x + length + 3, y + var14 + 3, var17, var17);
        for (ToolTipLine tip : toolTips) {
            String line = tip.text;
            line = line.replace(' ', ' ');
            if (tip.format == null)
                line = "§7" + line;
            else
                line = tip.format + line;
            fontRendererObj.drawStringWithShadow(line, x, y, -1);
            y += 10 + tip.getSpacing();
        }
        this.zLevel = 0.0F;
        itemRender.zLevel = 0.0F;
    }
}
Also used : ToolTipLine(mods.railcraft.common.gui.tooltips.ToolTipLine)

Example 4 with ToolTipLine

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

the class FilteredTank method refreshTooltip.

@Override
protected void refreshTooltip() {
    toolTip.clear();
    int amount = getFluidAmount();
    FluidStack fluidStack = getFluid();
    Fluid fluid;
    if (Fluids.isEmpty(fluidStack))
        fluid = filter.get();
    else
        fluid = fluidStack.getFluid();
    if (fluid != null)
        toolTip.add(getFluidNameToolTip(fluid));
    toolTip.add(new ToolTipLine(String.format("%,d", amount) + " / " + String.format("%,d", getCapacity())));
}
Also used : ToolTipLine(mods.railcraft.common.gui.tooltips.ToolTipLine) FluidStack(net.minecraftforge.fluids.FluidStack) Fluid(net.minecraftforge.fluids.Fluid)

Aggregations

ToolTipLine (mods.railcraft.common.gui.tooltips.ToolTipLine)4 FluidStack (net.minecraftforge.fluids.FluidStack)2 EnumRarity (net.minecraft.item.EnumRarity)1 Fluid (net.minecraftforge.fluids.Fluid)1