This also allows now to create custom packets with a custom packet id which is not in the packets.json
45 lines
840 B
Rust
45 lines
840 B
Rust
use pumpkin_data::packet::clientbound::PLAY_SET_DISPLAY_OBJECTIVE;
|
|
use pumpkin_macros::client_packet;
|
|
use serde::Serialize;
|
|
|
|
use crate::VarInt;
|
|
|
|
#[derive(Serialize)]
|
|
#[client_packet(PLAY_SET_DISPLAY_OBJECTIVE)]
|
|
pub struct CDisplayObjective<'a> {
|
|
position: VarInt,
|
|
score_name: &'a str,
|
|
}
|
|
|
|
impl<'a> CDisplayObjective<'a> {
|
|
pub fn new(position: DisplaySlot, score_name: &'a str) -> Self {
|
|
Self {
|
|
position: VarInt(position as i32),
|
|
score_name,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[repr(i32)]
|
|
pub enum DisplaySlot {
|
|
List,
|
|
Sidebar,
|
|
BelowName,
|
|
TeamBlack,
|
|
TeamDarkBlue,
|
|
TeamDarkGreen,
|
|
TeanDarkAqua,
|
|
TeamDarkRed,
|
|
TeamDarkPurple,
|
|
TeamGold,
|
|
TeamGray,
|
|
TeamDarkGray,
|
|
TeamBlue,
|
|
TeamGreen,
|
|
TeamAqua,
|
|
TeamRed,
|
|
TeamLightPurple,
|
|
TeamYellow,
|
|
TeamWhite,
|
|
}
|