ItemTooltipEvent

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.neoforge.api.event.item.ItemTooltipEvent;

Description

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

Extends

ItemTooltipEvent extends PlayerEvent.

Listening to the event

This event can be listened to like so:

script.zs
events.register<crafttweaker.neoforge.api.event.item.ItemTooltipEvent>(event => {
println("ItemTooltipEvent ran!");
});

Members

Getter
script.zs
// ItemTooltipEvent.entity as Player
event.entity

Return Type: Player

Getter
script.zs
// ItemTooltipEvent.entity as LivingEntity
event.entity

Return Type: LivingEntity

Getter
script.zs
// ItemTooltipEvent.entity as Entity
event.entity

Return Type: Entity

Getter
Gets the extra tooltip flags, such as if advanced tooltips should be displayed.
script.zs
// ItemTooltipEvent.flags as TooltipFlag
event.flags

Return Type: TooltipFlag

flags() as TooltipFlag
Gets the extra tooltip flags, such as if advanced tooltips should be displayed.

Returns: The tooltip flags

script.zs
// ItemTooltipEvent.flags() as TooltipFlag;
event.flags();

Return Type: TooltipFlag

Getter
Gets the ItemStack that the tooltip is for.
script.zs
// ItemTooltipEvent.itemStack as IItemStack
event.itemStack

Return Type: IItemStack

itemStack() as IItemStack
Gets the ItemStack that the tooltip is for.

Returns: The ItemStack that the tooltip is for.

script.zs
// ItemTooltipEvent.itemStack() as IItemStack;
event.itemStack();

Return Type: IItemStack

Getter
Gets the player that is viewing the tooltip.

Note: The player can be null

script.zs
// ItemTooltipEvent.player as Player
event.player

Return Type: Player

player() as Player
Gets the player that is viewing the tooltip.

Note: The player can be null

Returns: The player that is viewing the tooltip.

script.zs
// ItemTooltipEvent.player() as Player;
event.player();

Return Type: Player

Getter
Gets the list of Components that make up the tooltip.
script.zs
// ItemTooltipEvent.tooltip as List<Component>
event.tooltip

Return Type: List<Component>

tooltip() as List<Component>
Gets the list of Components that make up the tooltip.

Returns: The list of Component that make up the tooltip.

script.zs
// ItemTooltipEvent.tooltip() as List<Component>;
event.tooltip();

Return Type: List<Component>