Skip to content

Commit

Permalink
Add text Titles
Browse files Browse the repository at this point in the history
  • Loading branch information
Snowiiii committed Aug 11, 2024
1 parent af912f3 commit 41442c5
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 12 deletions.
15 changes: 15 additions & 0 deletions pumpkin-protocol/src/client/play/c_actionbar.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use pumpkin_macros::packet;
use pumpkin_text::TextComponent;
use serde::Serialize;

#[derive(Serialize)]
#[packet(0x4C)]
pub struct CActionBar {
action_bar: TextComponent,
}

impl CActionBar {
pub fn new(action_bar: TextComponent) -> Self {
Self { action_bar }
}
}
15 changes: 15 additions & 0 deletions pumpkin-protocol/src/client/play/c_set_title.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use pumpkin_macros::packet;
use pumpkin_text::TextComponent;
use serde::Serialize;

#[derive(Serialize)]
#[packet(0x65)]
pub struct CTitleText {
title: TextComponent,
}

impl CTitleText {
pub fn new(title: TextComponent) -> Self {
Self { title }
}
}
15 changes: 15 additions & 0 deletions pumpkin-protocol/src/client/play/c_subtitle.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use pumpkin_macros::packet;
use pumpkin_text::TextComponent;
use serde::Serialize;

#[derive(Serialize)]
#[packet(0x63)]
pub struct CSubtitle {
subtitle: TextComponent,
}

impl CSubtitle {
pub fn new(subtitle: TextComponent) -> Self {
Self { subtitle }
}
}
6 changes: 6 additions & 0 deletions pumpkin-protocol/src/client/play/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mod c_actionbar;
mod c_change_difficulty;
mod c_chunk_data_update_light;
mod c_disguised_chat_message;
Expand All @@ -13,14 +14,17 @@ mod c_player_chat_message;
mod c_player_info_update;
mod c_remove_entities;
mod c_set_held_item;
mod c_set_title;
mod c_spawn_player;
mod c_subtitle;
mod c_sync_player_position;
mod c_system_chat_message;
mod c_update_entitiy_pos_rot;
mod c_update_entity_pos;
mod c_update_entity_rot;
mod player_action;

pub use c_actionbar::*;
pub use c_change_difficulty::*;
pub use c_chunk_data_update_light::*;
pub use c_disguised_chat_message::*;
Expand All @@ -36,7 +40,9 @@ pub use c_player_chat_message::*;
pub use c_player_info_update::*;
pub use c_remove_entities::*;
pub use c_set_held_item::*;
pub use c_set_title::*;
pub use c_spawn_player::*;
pub use c_subtitle::*;
pub use c_sync_player_position::*;
pub use c_system_chat_message::*;
pub use c_update_entitiy_pos_rot::*;
Expand Down
6 changes: 0 additions & 6 deletions pumpkin/src/commands/gamemode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ use super::Command;

pub struct GamemodeCommand {}

impl GamemodeCommand {
pub fn new() -> Self {
Self {}
}
}

impl<'a> Command<'a> for GamemodeCommand {
const NAME: &'a str = "gamemode";

Expand Down
6 changes: 0 additions & 6 deletions pumpkin/src/commands/pumpkin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ use super::Command;

pub struct PumpkinCommand {}

impl PumpkinCommand {
pub fn new() -> Self {
Self {}
}
}

impl<'a> Command<'a> for PumpkinCommand {
const NAME: &'a str = "pumpkin";

Expand Down

0 comments on commit 41442c5

Please sign in to comment.