Package net.minecraftforge.client.event
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
This event is fired when the colours for the tooltip background are determined.static class
Fires when a tooltip gathers theTooltipComponent
s to render.protected static class
Deprecated, for removal: This API element is subject to removal in a future version.static class
Deprecated, for removal: This API element is subject to removal in a future version.static class
Deprecated, for removal: This API element is subject to removal in a future version.static class
This event is fired before any tooltip calculations are done.Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
Field Summary
Modifier and TypeFieldDescriptionprotected List<ClientTooltipComponent>
protected Font
protected List<? extends FormattedText>
Deprecated, for removal: This API element is subject to removal in a future version.protected PoseStack
protected ItemStack
protected int
protected int
-
Constructor Summary
ConstructorDescriptionRenderTooltipEvent(ItemStack stack, PoseStack poseStack, int x, int y, Font font, List<ClientTooltipComponent> components)
RenderTooltipEvent(ItemStack stack, List<? extends FormattedText> lines, PoseStack matrixStack, int x, int y, Font fr)
Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Methods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getParentListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult, setup
-
Field Details
-
stack
-
lines
Deprecated, for removal: This API element is subject to removal in a future version. -
matrixStack
-
x
protected int x -
y
protected int y -
fr
-
components
-
-
Constructor Details
-
RenderTooltipEvent
@Deprecated(since="1.18", forRemoval=true) public RenderTooltipEvent(@Nonnull ItemStack stack, @Nonnull List<? extends FormattedText> lines, PoseStack matrixStack, int x, int y, @Nonnull Font fr)Deprecated, for removal: This API element is subject to removal in a future version. -
RenderTooltipEvent
public RenderTooltipEvent(@Nonnull ItemStack stack, PoseStack poseStack, int x, int y, @Nonnull Font font, @Nonnull List<ClientTooltipComponent> components)
-
-
Method Details
-
getStack
- Returns:
- The stack which the tooltip is being rendered for. As tooltips can be drawn without itemstacks, this stack may be empty.
-
getLines
Deprecated, for removal: This API element is subject to removal in a future version.usegetComponents()
The lines to be drawn. May change betweenRenderTooltipEvent.Pre
andRenderTooltipEvent.Post
.- Returns:
- An unmodifiable list of strings. Use
ItemTooltipEvent
to modify tooltip text.
-
getComponents
The components to be drawn. To modify this list useRenderTooltipEvent.GatherComponents
.- Returns:
- an unmodifiable list of tooltip components to be drawn.
-
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
- Returns:
- The
Font
instance the current render is using.
-
getComponents()