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.forge.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.forge.api.event.item.ItemTooltipEvent>(event => {
println("ItemTooltipEvent ran!");
});

Members

cancel()
Cancels the event. Same as setCanceled(true)
script.zs
// ItemTooltipEvent.cancel();
event.cancel();
Getter
script.zs
// ItemTooltipEvent.cancelable as bool
event.cancelable

Return Type: bool

cancelable() as bool
script.zs
// ItemTooltipEvent.cancelable() as bool;
event.cancelable();

Return Type: bool

Getter
script.zs
// ItemTooltipEvent.canceled as bool
event.canceled

Return Type: bool

Setter
script.zs
// ItemTooltipEvent.canceled = (cancel as bool);
event.canceled = myBool;

Parameters:

cancel Type: bool
canceled() as bool
script.zs
// ItemTooltipEvent.canceled() as bool;
event.canceled();

Return Type: bool

canceled(cancel as bool)
script.zs
// ItemTooltipEvent.canceled(cancel as bool);
event.canceled(myBool);

Parameters:

cancel Type: bool
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
script.zs
// ItemTooltipEvent.hasResult as bool
event.hasResult

Return Type: bool

hasResult() as bool
script.zs
// ItemTooltipEvent.hasResult() as bool;
event.hasResult();

Return Type: bool

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
script.zs
// ItemTooltipEvent.result as Result
event.result

Return Type: EventResult

Setter
script.zs
// ItemTooltipEvent.result = (result as Result);
event.result = myResult;

Parameters:

result Type: EventResult
result() as Result
script.zs
// ItemTooltipEvent.result() as Result;
event.result();

Return Type: EventResult

result(result as Result)
script.zs
// ItemTooltipEvent.result(result as Result);
event.result(myResult);

Parameters:

result Type: EventResult
setAllow()
sets the event's result to allow
script.zs
// ItemTooltipEvent.setAllow();
event.setAllow();
setDefault()
sets the event's result to default
script.zs
// ItemTooltipEvent.setDefault();
event.setDefault();
setDeny()
sets the event's result to deny
script.zs
// ItemTooltipEvent.setDeny();
event.setDeny();
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>