类 RenderTooltipEvent.GatherComponents
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.client.event.RenderTooltipEvent.GatherComponents
- 封闭类:
RenderTooltipEvent
public static class RenderTooltipEvent.GatherComponents
extends net.minecraftforge.eventbus.api.Event
Fired when a tooltip gathers the
TooltipComponent
s to be rendered, before any text wrapping or processing.
The list of components and the maximum width of the tooltip can be modified through this event.
This event is cancellable, and does not have a result.
If this event is cancelled, then the list of components will be empty, causing the tooltip to not be rendered and
the corresponding RenderTooltipEvent.Pre
and RenderTooltipEvent.Background
to not be fired.
This event is fired on the main Forge event bus, only on the logical client.
-
嵌套类概要
从类继承的嵌套类/接口 net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
字段概要
字段修饰符和类型字段说明private final ItemStack
private int
private final int
private final int
private final List
<com.mojang.datafixers.util.Either<FormattedText, TooltipComponent>> -
构造器概要
构造器构造器说明GatherComponents
(ItemStack itemStack, int screenWidth, int screenHeight, List<com.mojang.datafixers.util.Either<FormattedText, TooltipComponent>> tooltipElements, int maxWidth) -
方法概要
修饰符和类型方法说明返回 the item stack which the tooltip is being rendered for, or an empty item stack if there is no associated item stack。int
返回 the maximum width of the tooltip when being rendered。int
返回 the height of the screen。int
返回 the width of the screen。List
<com.mojang.datafixers.util.Either<FormattedText, TooltipComponent>> 返回 the modifiable list of elements to be rendered on the tooltip。void
setMaxWidth
(int maxWidth) Sets the maximum width of the tooltip.从类继承的方法 net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
字段详细资料
-
itemStack
-
screenWidth
private final int screenWidth -
screenHeight
private final int screenHeight -
tooltipElements
private final List<com.mojang.datafixers.util.Either<FormattedText,TooltipComponent>> tooltipElements -
maxWidth
private int maxWidth
-
-
构造器详细资料
-
GatherComponents
@Internal public GatherComponents(ItemStack itemStack, int screenWidth, int screenHeight, List<com.mojang.datafixers.util.Either<FormattedText, TooltipComponent>> tooltipElements, int maxWidth)
-
-
方法详细资料
-
getItemStack
返回 the item stack which the tooltip is being rendered for, or an empty item stack if there is no associated item stack。- 返回:
- the item stack which the tooltip is being rendered for, or an empty item stack if there is no associated item stack
-
getScreenWidth
public int getScreenWidth()返回 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.- 返回:
- the width of the screen
-
getScreenHeight
public int getScreenHeight()返回 the height of the screen。 The tooltip box is moved to be within the screen height.- 返回:
- the height of the screen
-
getTooltipElements
返回 the modifiable list of elements to be rendered on the tooltip。 These elements can be either formatted text or custom tooltip components.- 返回:
- the modifiable list of elements to be rendered on the tooltip
-
getMaxWidth
public int getMaxWidth()返回 the maximum width of the tooltip when being rendered。A value of
-1
means an unlimited maximum width. However, an unlimited maximum width will still be wrapped to be within the screen bounds.- 返回:
- the maximum width of the tooltip when being rendered
-
setMaxWidth
public void setMaxWidth(int maxWidth) Sets the maximum width of the tooltip. Use-1
for unlimited maximum width.- 参数:
maxWidth
- the new maximum width
-