Class HoverEvent<V>
- Type Parameters:
V- the value type
- All Implemented Interfaces:
ComponentBuilderApplicable, HoverEventSource<V>, StyleBuilderApplicable
A hover event displays a component when hovered
over by a mouse on the client.
- Since:
- 4.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAn enumeration of hover event actions.static final classThe value of ashow_entityhover event.static final classThe value of ashow_itemhover event. -
Method Summary
Modifier and TypeMethodDescriptionaction()Gets the hover event action.Represent this object as a hover event.asHoverEvent(UnaryOperator<V> op) Creates a hover event with value derived from this object.booleaninthashCode()static <V> HoverEvent<V> hoverEvent(HoverEvent.Action<V> action, V value) Creates a hover event.static HoverEvent<String> showAchievement(String value) Creates a hover event that shows an achievement on hover.static HoverEvent<HoverEvent.ShowEntity> showEntity(Keyed type, UUID id) Creates a hover event that show information about an entity on hover.static HoverEvent<HoverEvent.ShowEntity> showEntity(Keyed type, UUID id, @Nullable Component name) Creates a hover event that show information about an entity on hover.static HoverEvent<HoverEvent.ShowEntity> showEntity(Key type, UUID id) Creates a hover event that show information about an entity on hover.static HoverEvent<HoverEvent.ShowEntity> showEntity(Key type, UUID id, @Nullable Component name) Creates a hover event that show information about an entity on hover.static HoverEvent<HoverEvent.ShowEntity> showEntity(HoverEvent.ShowEntity entity) Creates a hover event that show information about an entity on hover.static HoverEvent<HoverEvent.ShowItem> Creates a hover event that shows an item on hover.static HoverEvent<HoverEvent.ShowItem> showItem(Keyed item, @Range(from=0L,to=2147483647L) int count, Map<Key, ? extends DataComponentValue> dataComponents) Creates a hover event that shows an item on hover.static HoverEvent<HoverEvent.ShowItem> showItem(Keyed item, @Range(from=0L,to=2147483647L) int count, @Nullable BinaryTagHolder nbt) Creates a hover event that shows an item on hover.static HoverEvent<HoverEvent.ShowItem> Creates a hover event that shows an item on hover.static HoverEvent<HoverEvent.ShowItem> showItem(Key item, @Range(from=0L,to=2147483647L) int count, @Nullable BinaryTagHolder nbt) Creates a hover event that shows an item on hover.static HoverEvent<HoverEvent.ShowItem> showItem(HoverEvent.ShowItem item) Creates a hover event that shows an item on hover.static HoverEvent<Component> Creates a hover event that shows text on hover.static HoverEvent<Component> showText(ComponentLike text) Creates a hover event that shows text on hover.voidstyleApply(Style.Builder style) Applies tostyle.toString()value()Gets the hover event value.Sets the hover event value.<C> HoverEvent<V> withRenderedValue(ComponentRenderer<C> renderer, C context) Returns a hover event with the value rendered usingrendererwhen possible.Methods inherited from interface StyleBuilderApplicable
componentBuilderApply
-
Method Details
-
showText
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
public static HoverEvent<HoverEvent.ShowItem> showItem(Key item, @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
public static HoverEvent<HoverEvent.ShowItem> showItem(Keyed item, @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
@Obsolete public static HoverEvent<HoverEvent.ShowItem> showItem(Key item, @Range(from=0L,to=2147483647L) int count, @Nullable BinaryTagHolder nbt) 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
- Obsolete since Minecraft
- obsolete since 1.20.5 and replaced with data components
-
showItem
@Obsolete public static HoverEvent<HoverEvent.ShowItem> showItem(Keyed item, @Range(from=0L,to=2147483647L) int count, @Nullable BinaryTagHolder nbt) Creates 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
- Obsolete since Minecraft
- obsolete since 1.20.5 and replaced with data components
-
showItem
public static HoverEvent<HoverEvent.ShowItem> showItem(Keyed item, @Range(from=0L,to=2147483647L) int count, 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
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
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
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
public static HoverEvent<HoverEvent.ShowEntity> showEntity(Key type, UUID id, @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
public static HoverEvent<HoverEvent.ShowEntity> showEntity(Keyed type, UUID id, @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
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
Creates a hover event that shows an achievement on hover.- Parameters:
value- the achievement value- Returns:
- a hover event
- Since:
- 4.14.0
- Obsolete since Minecraft
- removed in 1.12
-
hoverEvent
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
-
value
Sets the hover event value.- Parameters:
value- the hover event value- Returns:
- a new hover event with the value set
- Since:
- 4.0.0
-
withRenderedValue
Returns a hover event with the value rendered usingrendererwhen 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:HoverEventSourceRepresent this object as a hover event.- Specified by:
asHoverEventin interfaceHoverEventSource<V>- Returns:
- a hover event
-
asHoverEvent
Description copied from interface:HoverEventSourceCreates 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:
asHoverEventin interfaceHoverEventSource<V>- Parameters:
op- transformation on value- Returns:
- a hover event
-
styleApply
Description copied from interface:StyleBuilderApplicableApplies tostyle.- Specified by:
styleApplyin interfaceStyleBuilderApplicable- Parameters:
style- the style builder
-
equals
-
hashCode
-
toString
-