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;
}
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);
}
}
}
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);
}
}
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;
}
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;
}
Aggregations