35 lines
1.0 KiB
Rust
35 lines
1.0 KiB
Rust
use std::borrow::Cow;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use crate::Text;
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
#[serde(tag = "action", content = "contents", rename_all = "snake_case")]
|
|
#[allow(clippy::enum_variant_names)]
|
|
pub enum HoverEvent<'a> {
|
|
/// Displays a tooltip with the given text.
|
|
ShowText(Text<'a>),
|
|
/// Shows an item.
|
|
ShowItem {
|
|
/// Resource identifier of the item
|
|
id: Cow<'a, str>,
|
|
/// Number of the items in the stack
|
|
count: Option<i32>,
|
|
/// NBT information about the item (sNBT format)
|
|
tag: Cow<'a, str>,
|
|
},
|
|
/// Shows an entity.
|
|
ShowEntity {
|
|
/// The entity's UUID
|
|
id: uuid::Uuid,
|
|
/// Resource identifier of the entity
|
|
#[serde(rename = "type")]
|
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
kind: Option<Cow<'a, str>>,
|
|
/// Optional custom name for the entity
|
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
name: Option<Text<'a>>,
|
|
},
|
|
}
|