Pumpkin/pumpkin-protocol/src/client/play/c_display_objective.rs
Alexander Medvedev 03e81a1436 transfer packet id parsing to build time
This also allows now to create custom packets with a custom packet id which is not in the packets.json
2025-01-10 13:42:39 +01:00

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