Search in sources :

Example 6 with ToolTip

use of forestry.core.gui.tooltips.ToolTip in project ForestryMC by ForestryMC.

the class WidgetElementProvider method getToolTip.

@Nullable
@Override
public ToolTip getToolTip(int mouseX, int mouseY) {
    mouseX -= xPos;
    mouseY -= yPos;
    List<String> tooltip = scrollable.getToolTip(mouseX, mouseY);
    if (tooltip.isEmpty()) {
        return null;
    }
    ToolTip toolTip = new ToolTip();
    toolTip.add(tooltip);
    return toolTip;
}
Also used : ToolTip(forestry.core.gui.tooltips.ToolTip) Nullable(javax.annotation.Nullable)

Example 7 with ToolTip

use of forestry.core.gui.tooltips.ToolTip in project ForestryMC by ForestryMC.

the class GuiUtil method drawToolTips.

public static void drawToolTips(GuiForestry gui, Collection<?> objects, int mouseX, int mouseY) {
    for (Object obj : objects) {
        if (!(obj instanceof IToolTipProvider)) {
            continue;
        }
        IToolTipProvider provider = (IToolTipProvider) obj;
        if (!provider.isToolTipVisible()) {
            continue;
        }
        ToolTip tips = provider.getToolTip(mouseX - gui.getGuiLeft(), mouseY - gui.getGuiTop());
        if (tips == null) {
            continue;
        }
        boolean mouseOver = provider.isMouseOver(mouseX - gui.getGuiLeft(), mouseY - gui.getGuiTop());
        tips.onTick(mouseOver);
        if (mouseOver && tips.isReady()) {
            tips.refresh();
            drawToolTips(gui, tips, mouseX, mouseY);
        }
    }
}
Also used : ToolTip(forestry.core.gui.tooltips.ToolTip) IToolTipProvider(forestry.core.gui.tooltips.IToolTipProvider)

Example 8 with ToolTip

use of forestry.core.gui.tooltips.ToolTip in project ForestryMC by ForestryMC.

the class LedgerManager method drawTooltips.

public void drawTooltips(int mouseX, int mouseY) {
    Ledger ledger = getAtPosition(mouseX, mouseY);
    if (ledger != null) {
        ToolTip toolTip = new ToolTip();
        toolTip.add(ledger.getTooltip());
        GuiUtil.drawToolTips(gui, toolTip, mouseX, mouseY);
    }
}
Also used : ToolTip(forestry.core.gui.tooltips.ToolTip)

Example 9 with ToolTip

use of forestry.core.gui.tooltips.ToolTip in project ForestryMC by ForestryMC.

the class GameTokenWidget method getToolTip.

@Override
public ToolTip getToolTip(int mouseX, int mouseY) {
    EscritoireGameToken token = getToken();
    if (token == null || !token.isVisible()) {
        return null;
    }
    ToolTip tooltip = new ToolTip();
    tooltip.add(token.getTooltip());
    return tooltip;
}
Also used : ToolTip(forestry.core.gui.tooltips.ToolTip) EscritoireGameToken(forestry.core.tiles.EscritoireGameToken)

Example 10 with ToolTip

use of forestry.core.gui.tooltips.ToolTip in project ForestryMC by ForestryMC.

the class BiogasSlot method getToolTip.

@Override
public ToolTip getToolTip(int mouseX, int mouseY) {
    ToolTip toolTip = new ToolTip();
    IFluidTank tank = getTank();
    if (tank != null) {
        FluidStack fluid = tank.getFluid();
        if (fluid == null) {
            toolTip.add(Translator.translateToLocal("for.gui.empty"));
        } else {
            toolTip.add(fluid.getLocalizedName());
        }
    }
    return toolTip;
}
Also used : ToolTip(forestry.core.gui.tooltips.ToolTip) FluidStack(net.minecraftforge.fluids.FluidStack) IFluidTank(net.minecraftforge.fluids.IFluidTank)

Aggregations

ToolTip (forestry.core.gui.tooltips.ToolTip)15 Nullable (javax.annotation.Nullable)4 FluidStack (net.minecraftforge.fluids.FluidStack)3 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)3 IFilterLogic (forestry.api.genetics.IFilterLogic)2 Minecraft (net.minecraft.client.Minecraft)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 EnumRarity (net.minecraft.item.EnumRarity)2 ItemStack (net.minecraft.item.ItemStack)2 Fluid (net.minecraftforge.fluids.Fluid)2 EnumDatabaseTab (forestry.api.genetics.EnumDatabaseTab)1 IAlleleSpecies (forestry.api.genetics.IAlleleSpecies)1 IFilterRuleType (forestry.api.genetics.IFilterRuleType)1 IToolTipProvider (forestry.core.gui.tooltips.IToolTipProvider)1 EscritoireGameToken (forestry.core.tiles.EscritoireGameToken)1 IFluidTank (net.minecraftforge.fluids.IFluidTank)1