Class RenderTooltipEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.client.event.RenderTooltipEvent
Direct Known Subclasses:
RenderTooltipEvent.Color, RenderTooltipEvent.Post, RenderTooltipEvent.Pre

public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api.Event
A set of events which are fired at various points during tooltip rendering.

Can be used to change the rendering parameters, draw something extra, etc.

Do not use this event directly, use one of the subclasses:

  • Field Details

  • Constructor Details

  • Method Details

    • getStack

      @Nonnull public ItemStack getStack()
      Returns:
      The stack which the tooltip is being rendered for. As tooltips can be drawn without itemstacks, this stack may be empty.
    • getLines

      @Nonnull @Deprecated(since="1.18", forRemoval=true) public List<? extends FormattedText> getLines()
      Deprecated, for removal: This API element is subject to removal in a future version.
      The lines to be drawn. May change between RenderTooltipEvent.Pre and RenderTooltipEvent.Post.
      Returns:
      An unmodifiable list of strings. Use ItemTooltipEvent to modify tooltip text.
    • getComponents

      @Nonnull public List<ClientTooltipComponent> getComponents()
      The components to be drawn. To modify this list use RenderTooltipEvent.GatherComponents.
      Returns:
      an unmodifiable list of tooltip components to be drawn.
    • getMatrixStack

      public PoseStack getMatrixStack()
      Returns:
      The MatrixStack of the current rendering context
    • getX

      public int getX()
      Returns:
      The X position of the tooltip box. By default, the mouse X position.
    • getY

      public int getY()
      Returns:
      The Y position of the tooltip box. By default, the mouse Y position.
    • getFontRenderer

      @Nonnull public Font getFontRenderer()
      Returns:
      The Font instance the current render is using.