Class RenderTooltipEvent.Pre
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.client.event.RenderTooltipEvent
net.neoforged.neoforge.client.event.RenderTooltipEvent.Pre
- All Implemented Interfaces:
- net.neoforged.bus.api.ICancellableEvent
- Enclosing class:
- RenderTooltipEvent
public static class RenderTooltipEvent.Pre
extends RenderTooltipEvent
implements net.neoforged.bus.api.ICancellableEvent
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.
- 
Nested Class SummaryNested classes/interfaces inherited from class net.neoforged.neoforge.client.event.RenderTooltipEventRenderTooltipEvent.Color, RenderTooltipEvent.GatherComponents, RenderTooltipEvent.PreNested classes/interfaces inherited from class net.neoforged.bus.api.Eventnet.neoforged.bus.api.Event.HasResult, net.neoforged.bus.api.Event.Result
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate final ClientTooltipPositionerprivate final intprivate final intFields inherited from class net.neoforged.neoforge.client.event.RenderTooltipEventcomponents, font, graphics, itemStack, x, y
- 
Constructor SummaryConstructorsConstructorDescriptionPre(ItemStack stack, GuiGraphics graphics, int x, int y, int screenWidth, int screenHeight, Font font, List<ClientTooltipComponent> components, ClientTooltipPositioner positioner) 
- 
Method SummaryMethods inherited from class net.neoforged.neoforge.client.event.RenderTooltipEventgetComponents, getFont, getGraphics, getItemStack, getX, getYMethods inherited from class net.neoforged.bus.api.EventgetResult, hasResult, setResultMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.bus.api.ICancellableEventisCanceled, setCanceled
- 
Field Details- 
screenWidthprivate final int screenWidth
- 
screenHeightprivate final int screenHeight
- 
positioner
 
- 
- 
Constructor Details- 
Pre@Internal public Pre(ItemStack stack, GuiGraphics graphics, int x, int y, int screenWidth, int screenHeight, Font font, List<ClientTooltipComponent> components, ClientTooltipPositioner positioner) 
 
- 
- 
Method Details- 
getScreenWidthpublic 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
 
- 
getScreenHeightpublic 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
 
- 
getTooltipPositioner
- 
setFontSets the font to be used to render text.- Parameters:
- fr- the new font
 
- 
setXpublic void setX(int x) Sets the X origin of the tooltip.- Parameters:
- x- the new X origin
 
- 
setYpublic void setY(int y) Sets the Y origin of the tooltip.- Parameters:
- y- the new Y origin
 
 
-