src/main/java/dev/lambdaurora/spruceui/Tooltip.java
public static <T extends Tooltipable & SpruceWidget> void queueFor(T widget, int mouseX, int mouseY, int tooltipTicks,
                                                                       IntConsumer tooltipTicksSetter,
                                                                       long lastTick,
                                                                       LongConsumer lastTickSetter) {
        if (widget.isVisible()) {
            widget.getTooltip().ifPresent(tooltip -> {
                long currentRender = System.currentTimeMillis();
                if (lastTick != 0) {
                    if (currentRender - lastTick >= 20) {
                        tooltipTicksSetter.accept(tooltipTicks + 1);
                        lastTickSetter.accept(currentRender);
                    }
                } else lastTickSetter.accept(currentRender);

                if (!widget.isFocused() && !widget.isMouseHovered())
                    tooltipTicksSetter.accept(0);

                if (!tooltip.getString().isEmpty() && tooltipTicks >= 45) {
                    var wrappedTooltipText = MinecraftClient.getInstance().textRenderer.wrapLines(
                            tooltip, Math.max(widget.getWidth() * 2 / 3, 200));
                    if (widget.isMouseHovered())
                        create(mouseX, mouseY, wrappedTooltipText).queue();
                    else if (widget.isFocused())
                        create(widget.getX() - 12, widget.getY() + widget.getHeight() + 16,
                                wrappedTooltipText)
                                .queue();
                }
            });
        }
    }
/**
     * Queues the tooltip of the widget to render.
     *
     * @param widget the widget
     * @param mouseX the mouse X coordinate
     * @param mouseY the mouse Y coordinate
     * @param <T> the type of the widget
     * @since 1.6.0
     */
Queues the tooltip of the widget to render.
Queues the tooltip of the widget to render .
public static <T extends Tooltipable & SpruceWidget> void queueFor(T widget, int mouseX, int mouseY, int tooltipTicks,
                                                                       IntConsumer tooltipTicksSetter,
                                                                       long lastTick,
                                                                       LongConsumer lastTickSetter) {
        if (widget.isVisible()) {
            widget.getTooltip().ifPresent(tooltip -> {
                long currentRender = System.currentTimeMillis();
                if (lastTick != 0) {
                    if (currentRender - lastTick >= 20) {
                        tooltipTicksSetter.accept(tooltipTicks + 1);
                        lastTickSetter.accept(currentRender);
                    }
                } else lastTickSetter.accept(currentRender);
                if (!widget.isFocused() && !widget.isMouseHovered())
                    tooltipTicksSetter.accept(0);
                if (!tooltip.getString().isEmpty() && tooltipTicks >= 45) {
                    var wrappedTooltipText = MinecraftClient.getInstance().textRenderer.wrapLines(
                            tooltip, Math.max(widget.getWidth() * 2 / 3, 200));
                    if (widget.isMouseHovered())
                        create(mouseX, mouseY, wrappedTooltipText).queue();
                    else if (widget.isFocused())
                        create(widget.getX() - 12, widget.getY() + widget.getHeight() + 16,
                                wrappedTooltipText)
                                .queue();
                }
            });
        }
    }
public static < T extends Tooltipable & SpruceWidget > void queueFor ( T widget , int mouseX , int mouseY , int tooltipTicks , IntConsumer tooltipTicksSetter , long lastTick , LongConsumer lastTickSetter ) { if ( widget . isVisible ( ) ) { widget . getTooltip ( ) . ifPresent ( tooltip -> { long currentRender = System . currentTimeMillis ( ) ; if ( lastTick != 0 ) { if ( currentRender - lastTick >= 20 ) { tooltipTicksSetter . accept ( tooltipTicks + 1 ) ; lastTickSetter . accept ( currentRender ) ; } } else lastTickSetter . accept ( currentRender ) ; if ( ! widget . isFocused ( ) && ! widget . isMouseHovered ( ) ) tooltipTicksSetter . accept ( 0 ) ; if ( ! tooltip . getString ( ) . isEmpty ( ) && tooltipTicks >= 45 ) { var wrappedTooltipText = MinecraftClient . getInstance ( ) . textRenderer . wrapLines ( tooltip , Math . max ( widget . getWidth ( ) * 2 / 3 , 200 ) ) ; if ( widget . isMouseHovered ( ) ) create ( mouseX , mouseY , wrappedTooltipText ) . queue ( ) ; else if ( widget . isFocused ( ) ) create ( widget . getX ( ) - 12 , widget . getY ( ) + widget . getHeight ( ) + 16 , wrappedTooltipText ) . queue ( ) ; } } ) ; } }
Queues the tooltip of the widget to render.
Queues the tooltip of the widget to render .