Skip to main content

steel_protocol/packets/game/
c_set_subtitle_text.rs

1use steel_macros::{ClientPacket, WriteTo};
2use steel_registry::packets::play::C_SET_SUBTITLE_TEXT;
3use text_components::TextComponent;
4
5/// Sets the subtitle text displayed by the client.
6#[derive(ClientPacket, WriteTo, Clone, Debug)]
7#[packet_id(Play = C_SET_SUBTITLE_TEXT)]
8pub struct CSetSubtitleText {
9    /// Text to display as the subtitle.
10    pub text: TextComponent,
11}
12
13impl CSetSubtitleText {
14    /// Creates a subtitle-text packet.
15    #[must_use]
16    pub fn new(text: impl Into<TextComponent>) -> Self {
17        Self { text: text.into() }
18    }
19}