Class RenderTooltipEvent.Pre

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.client.event.RenderTooltipEvent
net.minecraftforge.client.event.RenderTooltipEvent.Pre
Enclosing class:
RenderTooltipEvent

public static class RenderTooltipEvent.Pre extends RenderTooltipEvent
Fired before the tooltip is rendered. This can be used to modify the positioning and font of the tooltip.

This event is cancellable, and does not have a result. If this event is cancelled, then the tooltip will not be rendered and the corresponding RenderTooltipEvent.Color will not be fired.

This event is fired on the main Forge event bus, only on the logical client.

  • Field Details

    • screenWidth

      private final int screenWidth
    • screenHeight

      private final int screenHeight
  • Constructor Details

  • Method Details

    • getScreenWidth

      public int getScreenWidth()
      Returns the width of the screen.. The lines of text within the tooltip are wrapped to be within the screen width, and the tooltip box itself is moved to be within the screen width.
      Returns:
      the width of the screen
    • getScreenHeight

      public int getScreenHeight()
      Returns the height of the screen. The tooltip box is moved to be within the screen height.
      Returns:
      the height of the screen
    • setFont

      public void setFont(@NotNull @NotNull Font fr)
      Sets the font to be used to render text.
      Parameters:
      fr - the new font
    • setX

      public void setX(int x)
      Sets the X origin of the tooltip.
      Parameters:
      x - the new X origin
    • setY

      public void setY(int y)
      Sets the Y origin of the tooltip.
      Parameters:
      y - the new Y origin