Package net.kyori.adventure.text.event
Class HoverEvent.ShowItem
java.lang.Object
net.kyori.adventure.text.event.HoverEvent.ShowItem
- All Implemented Interfaces:
net.kyori.examination.Examinable
- Enclosing class:
- HoverEvent<V>
public static final class HoverEvent.ShowItem
extends Object
implements net.kyori.examination.Examinable
The value of a
show_item
hover event.- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescription@org.jetbrains.annotations.Range(from=0L, to=2147483647L) int
count()
Gets the count.@NotNull HoverEvent.ShowItem
count
(@org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count) Sets the count.@NotNull Map<Key,
DataComponentValue> Get the data components used for this item.@NotNull HoverEvent.ShowItem
dataComponents
(@NotNull Map<Key, DataComponentValue> holder) Set the data components used on this item.<V extends DataComponentValue>
@NotNull Map<Key,V> dataComponentsAs
(@NotNull Class<V> targetType) Return an unmodifiable map of data components coerced to the target type.boolean
@NotNull Stream<? extends net.kyori.examination.ExaminableProperty>
int
hashCode()
@NotNull Key
item()
Gets the item.@NotNull HoverEvent.ShowItem
Sets the item.@Nullable BinaryTagHolder
nbt()
Deprecated.since Minecraft 1.20.5 and replaced with data components, not scheduled for removal@NotNull HoverEvent.ShowItem
nbt
(@Nullable BinaryTagHolder nbt) Deprecated.since Minecraft 1.20.5 and replaced with data components, not scheduled for removalstatic @NotNull HoverEvent.ShowItem
Deprecated.for removal since 4.14.0, useshowItem(Keyed, int)
instead.static @NotNull HoverEvent.ShowItem
of
(@NotNull Keyed item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count, @Nullable BinaryTagHolder nbt) Deprecated.for removal since 4.14.0, useshowItem(Keyed, int, BinaryTagHolder)
instead.static @NotNull HoverEvent.ShowItem
Deprecated.for removal since 4.14.0, useshowItem(Key, int)
instead.static @NotNull HoverEvent.ShowItem
of
(@NotNull Key item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count, @Nullable BinaryTagHolder nbt) Deprecated.for removal since 4.14.0, useshowItem(Key, int, BinaryTagHolder)
instead.static @NotNull HoverEvent.ShowItem
Creates.static @NotNull HoverEvent.ShowItem
showItem
(@NotNull Keyed item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count, @NotNull Map<Key, ? extends DataComponentValue> dataComponents) Creates.static @NotNull 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.ShowItem
Creates.static @NotNull HoverEvent.ShowItem
showItem
(@NotNull Key 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 removaltoString()
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
-
Method Details
-
showItem
@NotNull public static @NotNull HoverEvent.ShowItem showItem(@NotNull @NotNull Key item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count) Creates.- Parameters:
item
- the itemcount
- the count- Returns:
- a
ShowItem
- Since:
- 4.14.0
-
of
@Deprecated @ScheduledForRemoval(inVersion="5.0.0") @NotNull public static @NotNull HoverEvent.ShowItem of(@NotNull @NotNull Key item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count) Deprecated.for removal since 4.14.0, useshowItem(Key, int)
instead.Creates.- Parameters:
item
- the itemcount
- the count- Returns:
- a
ShowItem
- Since:
- 4.0.0
-
showItem
@NotNull public static @NotNull HoverEvent.ShowItem showItem(@NotNull @NotNull Keyed item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count) Creates.- Parameters:
item
- the itemcount
- the count- Returns:
- a
ShowItem
- Since:
- 4.14.0
-
of
@Deprecated @ScheduledForRemoval(inVersion="5.0.0") @NotNull public static @NotNull HoverEvent.ShowItem of(@NotNull @NotNull Keyed item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count) Deprecated.for removal since 4.14.0, useshowItem(Keyed, int)
instead.Creates.- Parameters:
item
- the itemcount
- the count- Returns:
- a
ShowItem
- Since:
- 4.6.0
-
showItem
@Deprecated @NotNull public static @NotNull HoverEvent.ShowItem showItem(@NotNull @NotNull Key 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.- Parameters:
item
- the itemcount
- the countnbt
- the nbt- Returns:
- a
ShowItem
- Since:
- 4.14.0
-
of
@Deprecated @ScheduledForRemoval(inVersion="5.0.0") @NotNull public static @NotNull HoverEvent.ShowItem of(@NotNull @NotNull Key item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count, @Nullable @Nullable BinaryTagHolder nbt) Deprecated.for removal since 4.14.0, useshowItem(Key, int, BinaryTagHolder)
instead.Creates.- Parameters:
item
- the itemcount
- the countnbt
- the nbt- Returns:
- a
ShowItem
- Since:
- 4.0.0
-
showItem
@Deprecated @NotNull public static @NotNull 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.- Parameters:
item
- the itemcount
- the countnbt
- the nbt- Returns:
- a
ShowItem
- Since:
- 4.14.0
-
of
@Deprecated @ScheduledForRemoval(inVersion="5.0.0") @NotNull public static @NotNull HoverEvent.ShowItem of(@NotNull @NotNull Keyed item, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count, @Nullable @Nullable BinaryTagHolder nbt) Deprecated.for removal since 4.14.0, useshowItem(Keyed, int, BinaryTagHolder)
instead.Creates.- Parameters:
item
- the itemcount
- the countnbt
- the nbt- Returns:
- a
ShowItem
- Since:
- 4.6.0
-
showItem
@NotNull public static @NotNull 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.- Parameters:
item
- the itemcount
- the countdataComponents
- the data components- Returns:
- a
ShowItem
- Since:
- 4.17.0
- Since Minecraft:
- 1.20.5
-
item
Gets the item.- Returns:
- the item
- Since:
- 4.0.0
-
item
Sets the item.- Parameters:
item
- the item- Returns:
- a
ShowItem
- Since:
- 4.0.0
-
count
public @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count()Gets the count.- Returns:
- the count
- Since:
- 4.0.0
-
count
@NotNull public @NotNull HoverEvent.ShowItem count(@org.jetbrains.annotations.Range(from=0L, to=2147483647L) int count) Sets the count.- Parameters:
count
- the count- Returns:
- a
ShowItem
- Since:
- 4.0.0
-
nbt
Deprecated.since Minecraft 1.20.5 and replaced with data components, not scheduled for removalGets the nbt.If there are data components on this item, it will never have NBT data.
- Returns:
- the nbt
- Since:
- 4.0.0
-
nbt
@Deprecated @NotNull public @NotNull HoverEvent.ShowItem nbt(@Nullable @Nullable BinaryTagHolder nbt) Deprecated.since Minecraft 1.20.5 and replaced with data components, not scheduled for removalSets the nbt.This will clear any modern data components set on the item.
- Parameters:
nbt
- the nbt- Returns:
- a
ShowItem
- Since:
- 4.0.0
-
dataComponents
Get the data components used for this item.If there is NBT data on this item, it will never have any data components set.
- Returns:
- an unmodifiable map of data components
- Since:
- 4.17.0
- Since Minecraft:
- 1.20.5
-
dataComponents
@NotNull public @NotNull HoverEvent.ShowItem dataComponents(@NotNull @NotNull Map<Key, DataComponentValue> holder) Set the data components used on this item.This will clear any legacy NBT-format data on the item.
- Parameters:
holder
- the new data components to set- Returns:
- a show item data object that has the provided components
- Since:
- 4.17.0
- Since Minecraft:
- 1.20.5
-
dataComponentsAs
@NotNull public <V extends DataComponentValue> @NotNull Map<Key,V> dataComponentsAs(@NotNull @NotNull Class<V> targetType) Return an unmodifiable map of data components coerced to the target type.If there is no converter registered with the
DataComponentValueConverterRegistry
for the conversion of a value, aIllegalArgumentException
will be thrown.- Type Parameters:
V
- the new data component value type- Parameters:
targetType
- the expected target type- Returns:
- the unmodifiable map
- Since:
- 4.17.0
-
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
-