Add text Titles

This commit is contained in:
Snowiiii 2024-08-11 14:18:56 +02:00
parent af912f3088
commit 41442c5b5d
6 changed files with 51 additions and 12 deletions

View File

@ -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 }
}
}

View File

@ -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 }
}
}

View File

@ -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 }
}
}

View File

@ -1,3 +1,4 @@
mod c_actionbar;
mod c_change_difficulty;
mod c_chunk_data_update_light;
mod c_disguised_chat_message;
@ -13,7 +14,9 @@ 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;
@ -21,6 +24,7 @@ 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::*;
@ -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::*;

View File

@ -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";

View File

@ -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";