Class HoverEvent<V>
- Type Parameters:
V
- the value type
- All Implemented Interfaces:
ComponentBuilderApplicable
,HoverEventSource<V>
,StyleBuilderApplicable
,net.kyori.examination.Examinable
A hover event displays a component
when hovered
over by a mouse on the client.
- Since:
- 4.0.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
An enumeration of hover event actions.static final class
The value of ashow_entity
hover event.static final class
The value of ashow_item
hover event. -
Method Summary
Modifier and TypeMethodDescription@NotNull HoverEvent.Action<V>
action()
Gets the hover event action.@NotNull HoverEvent<V>
Represent this object as a hover event.@NotNull HoverEvent<V>
asHoverEvent
(@NotNull UnaryOperator<V> op) Creates a hover event with value derived from this object.boolean
@NotNull Stream<? extends net.kyori.examination.ExaminableProperty>
int
hashCode()
static <V> @NotNull HoverEvent<V>
hoverEvent
(@NotNull HoverEvent.Action<V> action, V value) Creates a hover event.static @NotNull HoverEvent<String>
showAchievement
(@NotNull String value) Deprecated.Removed in Vanilla 1.12, but we keep it for backwards compatibilitystatic @NotNull HoverEvent<HoverEvent.ShowEntity>
showEntity
(@NotNull Keyed type, @NotNull UUID id) Creates a hover event that show information about an entity on hover.static @NotNull HoverEvent<HoverEvent.ShowEntity>
showEntity
(@NotNull Keyed type, @NotNull UUID id, @Nullable Component name) Creates a hover event that show information about an entity on hover.static @NotNull HoverEvent<HoverEvent.ShowEntity>
showEntity
(@NotNull Key type, @NotNull UUID id) Creates a hover event that show information about an entity on hover.static @NotNull HoverEvent<HoverEvent.ShowEntity>
showEntity
(@NotNull Key type, @NotNull UUID id, @Nullable Component name) Creates a hover event that show information about an entity on hover.static @NotNull HoverEvent<HoverEvent.ShowEntity>
showEntity
(@NotNull HoverEvent.ShowEntity entity) Creates a hover event that show information about an entity on hover.static @NotNull HoverEvent<HoverEvent.ShowItem>
Creates a hover event that shows an item on hover.static @NotNull HoverEvent<HoverEvent.ShowItem>
showItem
(@NotNull Keyed item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count, @NotNull Map<Key, ? extends DataComponentValue> dataComponents) Creates a hover event that shows an item on hover.static @NotNull HoverEvent<HoverEvent.ShowItem>
showItem
(@NotNull Keyed item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count, @Nullable BinaryTagHolder nbt) Deprecated.since Minecraft 1.20.5 and replaced with data components, not scheduled for removalstatic @NotNull HoverEvent<HoverEvent.ShowItem>
Creates a hover event that shows an item on hover.static @NotNull HoverEvent<HoverEvent.ShowItem>
showItem
(@NotNull Key item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count, @Nullable BinaryTagHolder nbt) Deprecated.static @NotNull HoverEvent<HoverEvent.ShowItem>
showItem
(@NotNull HoverEvent.ShowItem item) Creates a hover event that shows an item on hover.static @NotNull HoverEvent<Component>
Creates a hover event that shows text on hover.static @NotNull HoverEvent<Component>
showText
(@NotNull ComponentLike text) Creates a hover event that shows text on hover.void
styleApply
(@NotNull Style.Builder style) Applies tostyle
.toString()
value()
Gets the hover event value.@NotNull HoverEvent<V>
Sets the hover event value.<C> @NotNull HoverEvent<V>
withRenderedValue
(@NotNull ComponentRenderer<C> renderer, C context) Returns a hover event with the value rendered usingrenderer
when possible.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.kyori.examination.Examinable
examinableName, examine
Methods inherited from interface net.kyori.adventure.text.format.StyleBuilderApplicable
componentBuilderApply
-
Method Details
-
showText
@NotNull public static @NotNull HoverEvent<Component> showText(@NotNull @NotNull ComponentLike text) Creates a hover event that shows text on hover.- Parameters:
text
- the text to show on hover- Returns:
- a hover event
- Since:
- 4.2.0
-
showText
Creates a hover event that shows text on hover.- Parameters:
text
- the text to show on hover- Returns:
- a hover event
- Since:
- 4.0.0
-
showItem
@NotNull public static @NotNull HoverEvent<HoverEvent.ShowItem> showItem(@NotNull @NotNull Key item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count) Creates a hover event that shows an item on hover.- Parameters:
item
- the itemcount
- the count- Returns:
- a hover event
- Since:
- 4.0.0
-
showItem
@NotNull public static @NotNull HoverEvent<HoverEvent.ShowItem> showItem(@NotNull @NotNull Keyed item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count) Creates a hover event that shows an item on hover.- Parameters:
item
- the itemcount
- the count- Returns:
- a hover event
- Since:
- 4.6.0
-
showItem
@Deprecated @NotNull public static @NotNull HoverEvent<HoverEvent.ShowItem> showItem(@NotNull @NotNull Key item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count, @Nullable @Nullable BinaryTagHolder nbt) Deprecated.Creates a hover event that shows an item on hover.- Parameters:
item
- the itemcount
- the countnbt
- the nbt- Returns:
- a hover event
- Since:
- 4.0.0
-
showItem
@Deprecated @NotNull public static @NotNull HoverEvent<HoverEvent.ShowItem> showItem(@NotNull @NotNull Keyed item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count, @Nullable @Nullable BinaryTagHolder nbt) Deprecated.since Minecraft 1.20.5 and replaced with data components, not scheduled for removalCreates a hover event that shows an item on hover.- Parameters:
item
- the itemcount
- the countnbt
- the nbt- Returns:
- a hover event
- Since:
- 4.6.0
-
showItem
@NotNull public static @NotNull HoverEvent<HoverEvent.ShowItem> showItem(@NotNull @NotNull Keyed item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count, @NotNull @NotNull Map<Key, ? extends DataComponentValue> dataComponents) Creates a hover event that shows an item on hover.- Parameters:
item
- the itemcount
- the countdataComponents
- the data components- Returns:
- a hover event
- Since:
- 4.17.0
-
showItem
@NotNull public static @NotNull HoverEvent<HoverEvent.ShowItem> showItem(@NotNull @NotNull HoverEvent.ShowItem item) Creates a hover event that shows an item on hover.- Parameters:
item
- the item to show on hover- Returns:
- a hover event
- Since:
- 4.0.0
-
showEntity
@NotNull public static @NotNull HoverEvent<HoverEvent.ShowEntity> showEntity(@NotNull @NotNull Key type, @NotNull @NotNull UUID id) Creates a hover event that show information about an entity on hover.In the official Minecraft: Java Edition client, no information will be shown unless the "Advanced tooltips" debug option is enabled.
- Parameters:
type
- the typeid
- the id- Returns:
- a
ShowEntity
- Since:
- 4.0.0
-
showEntity
@NotNull public static @NotNull HoverEvent<HoverEvent.ShowEntity> showEntity(@NotNull @NotNull Keyed type, @NotNull @NotNull UUID id) Creates a hover event that show information about an entity on hover.In the official Minecraft: Java Edition client, no information will be shown unless the "Advanced tooltips" debug option is enabled.
- Parameters:
type
- the typeid
- the id- Returns:
- a
ShowEntity
- Since:
- 4.6.0
-
showEntity
@NotNull public static @NotNull HoverEvent<HoverEvent.ShowEntity> showEntity(@NotNull @NotNull Key type, @NotNull @NotNull UUID id, @Nullable @Nullable Component name) Creates a hover event that show information about an entity on hover.In the official Minecraft: Java Edition client, no information will be shown unless the "Advanced tooltips" debug option is enabled.
- Parameters:
type
- the typeid
- the idname
- the name- Returns:
- a
ShowEntity
- Since:
- 4.0.0
-
showEntity
@NotNull public static @NotNull HoverEvent<HoverEvent.ShowEntity> showEntity(@NotNull @NotNull Keyed type, @NotNull @NotNull UUID id, @Nullable @Nullable Component name) Creates a hover event that show information about an entity on hover.In the official Minecraft: Java Edition client, no information will be shown unless the "Advanced tooltips" debug option is enabled.
- Parameters:
type
- the typeid
- the idname
- the name- Returns:
- a
ShowEntity
- Since:
- 4.6.0
-
showEntity
@NotNull public static @NotNull HoverEvent<HoverEvent.ShowEntity> showEntity(@NotNull @NotNull HoverEvent.ShowEntity entity) Creates a hover event that show information about an entity on hover.In the official Minecraft: Java Edition client, no information will be shown unless the "Advanced tooltips" debug option is enabled.
- Parameters:
entity
- the entity to show on hover- Returns:
- a hover event
- Since:
- 4.0.0
-
showAchievement
@Deprecated @NotNull public static @NotNull HoverEvent<String> showAchievement(@NotNull @NotNull String value) Deprecated.Removed in Vanilla 1.12, but we keep it for backwards compatibilityCreates a hover event that shows an achievement on hover.- Parameters:
value
- the achievement value- Returns:
- a hover event
- Since:
- 4.14.0
-
hoverEvent
@NotNull public static <V> @NotNull HoverEvent<V> hoverEvent(@NotNull @NotNull HoverEvent.Action<V> action, @NotNull V value) Creates a hover event.- Type Parameters:
V
- the value type- Parameters:
action
- the actionvalue
- the value- Returns:
- a click event
- Since:
- 4.0.0
-
action
Gets the hover event action.- Returns:
- the hover event action
- Since:
- 4.0.0
-
value
Gets the hover event value.- Returns:
- the hover event value
- Since:
- 4.0.0
-
value
Sets the hover event value.- Parameters:
value
- the hover event value- Returns:
- a hover event
- Since:
- 4.0.0
-
withRenderedValue
@NotNull public <C> @NotNull HoverEvent<V> withRenderedValue(@NotNull @NotNull ComponentRenderer<C> renderer, @NotNull C context) Returns a hover event with the value rendered usingrenderer
when possible.- Type Parameters:
C
- the context type- Parameters:
renderer
- the renderercontext
- the render context- Returns:
- a hover event
- Since:
- 4.0.0
-
asHoverEvent
Description copied from interface:HoverEventSource
Represent this object as a hover event.- Specified by:
asHoverEvent
in interfaceHoverEventSource<V>
- Returns:
- a hover event
-
asHoverEvent
Description copied from interface:HoverEventSource
Creates a hover event with value derived from this object.The event value will be passed through the provided callback to allow transforming the original value of the event.
- Specified by:
asHoverEvent
in interfaceHoverEventSource<V>
- Parameters:
op
- transformation on value- Returns:
- a hover event
-
styleApply
Description copied from interface:StyleBuilderApplicable
Applies tostyle
.- Specified by:
styleApply
in interfaceStyleBuilderApplicable
- Parameters:
style
- the style builder
-
equals
-
hashCode
public int hashCode() -
examinableProperties
@NotNull public @NotNull Stream<? extends net.kyori.examination.ExaminableProperty> examinableProperties()- Specified by:
examinableProperties
in interfacenet.kyori.examination.Examinable
-
toString
-