Class RenderTooltipEvent.Texture

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.client.event.RenderTooltipEvent
net.neoforged.neoforge.client.event.RenderTooltipEvent.Texture
Enclosing class:
RenderTooltipEvent

public static class RenderTooltipEvent.Texture extends RenderTooltipEvent
Fired when the textures for the tooltip background are determined. This can be used to modify the background and frame texture.

This event is not cancellable.

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

  • Field Details

    • originalTexture

      @Nullable private final @Nullable net.minecraft.resources.ResourceLocation originalTexture
    • texture

      @Nullable private @Nullable net.minecraft.resources.ResourceLocation texture
  • Constructor Details

    • Texture

      @Internal public Texture(net.minecraft.world.item.ItemStack stack, net.minecraft.client.gui.GuiGraphics graphics, int x, int y, net.minecraft.client.gui.Font font, List<net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent> components, @Nullable @Nullable net.minecraft.resources.ResourceLocation texture)
  • Method Details

    • getOriginalTexture

      @Nullable public @Nullable net.minecraft.resources.ResourceLocation getOriginalTexture()
      Returns the original texture location given to the tooltip render method (may originate from DataComponents.TOOLTIP_STYLE).
      Returns:
      the original texture location given to the tooltip render method (may originate from DataComponents.TOOLTIP_STYLE)
    • getTexture

      @Nullable public @Nullable net.minecraft.resources.ResourceLocation getTexture()
      Returns the texture location that will be used to render the tooltip.
      Returns:
      the texture location that will be used to render the tooltip
    • setTexture

      public void setTexture(@Nullable @Nullable net.minecraft.resources.ResourceLocation texture)
      Set the texture to use for the tooltip background and frame or null to use the default textures.

      The given ResourceLocation will be prefixed with tooltip/ and suffixed with _background and _frame to determine the background and frame texture respectively