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
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.client.event.RenderTooltipEvent
RenderTooltipEvent.GatherComponents, RenderTooltipEvent.Pre, RenderTooltipEvent.Texture
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @Nullable net.minecraft.resources.ResourceLocation
private @Nullable net.minecraft.resources.ResourceLocation
Fields inherited from class net.neoforged.neoforge.client.event.RenderTooltipEvent
components, font, graphics, itemStack, x, y
-
Constructor Summary
ConstructorsConstructorDescriptionTexture
(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 net.minecraft.resources.ResourceLocation texture) -
Method Summary
Modifier and TypeMethodDescription@Nullable net.minecraft.resources.ResourceLocation
Returns the original texture location given to the tooltip render method (may originate fromDataComponents.TOOLTIP_STYLE
).@Nullable net.minecraft.resources.ResourceLocation
Returns the texture location that will be used to render the tooltip.void
setTexture
(@Nullable net.minecraft.resources.ResourceLocation texture) Set the texture to use for the tooltip background and frame ornull
to use the default textures.Methods inherited from class net.neoforged.neoforge.client.event.RenderTooltipEvent
getComponents, getFont, getGraphics, getItemStack, getX, getY
-
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 fromDataComponents.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 ornull
to use the default textures.The given
ResourceLocation
will be prefixed withtooltip/
and suffixed with_background
and_frame
to determine the background and frame texture respectively
-