Skip to main content

steel_protocol/packets/game/
c_set_action_bar_text.rs

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