ItemTooltipEvent
Link to itemtooltipevent
This event is fired whenever a tooltip is calculated.
Note: the player may not always be present, make sure you check if it is null before trying to use it
The event is not cancelable.
The event does not have a result.
导入类
Link to 导入类
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.event.entity.player.ItemTooltipEvent;
Extending PlayerEvent
Link to extending-playerevent
ItemTooltipEvent extends PlayerEvent. That means all methods available in PlayerEvent are also available in ItemTooltipEvent
使用方式
Link to 使用方式
Name: getFlags
Gets the extra tooltip flags, such as if advanced tooltips should be displayed.
Returns: The tooltip flags
Return Type: TooltipFlag
ZenScript Copy// ItemTooltipEvent.getFlags() as TooltipFlag
event.getFlags();
Name: getItemStack
Gets the ItemStack that the tooltip is for.
Returns: The ItemStack that the tooltip is for.
Return Type: ItemStack
ZenScript Copy// ItemTooltipEvent.getItemStack() as ItemStack
event.getItemStack();
Name: getPlayer
Gets the player that is viewing the tooltip.
Note: The player can be null
Returns: The player htat is viewing the tooltip.
Return Type: Player?
ZenScript Copy// ItemTooltipEvent.getPlayer() as Player?
event.getPlayer();
名称 | 类型 | 可获得 | 可设置 | 描述 |
---|---|---|---|---|
名称 flags | 类型 TooltipFlag | 可获得 true | 可设置 false | 描述 Gets the extra tooltip flags, such as if advanced tooltips should be displayed. |
名称 物品应用 | 类型 物品应用 | 可获得 true | 可设置 false | 描述 Gets the ItemStack that the tooltip is for. |
名称 player | 类型 Player? | 可获得 true | 可设置 false | 描述 Gets the player that is viewing the tooltip. Note: The player can be null |
名称 工具提示 | 类型 stdlib.List<Component> | 可获得 true | 可设置 false | 描述 Gets the list of Components that make up the tooltip. |