31 lines
921 B
Rust
31 lines
921 B
Rust
|
|
use crate::protocol::Serializable;
|
|
use crate::protocol::packet::play::serverbound::PluginMessageServerbound;
|
|
use crate::protocol::packet::play::serverbound::PluginMessageServerbound_i16;
|
|
|
|
pub struct Brand {
|
|
pub brand: String,
|
|
}
|
|
|
|
impl Brand {
|
|
pub fn as_message(self) -> PluginMessageServerbound {
|
|
let mut data = vec![];
|
|
Serializable::write_to(&self.brand, &mut data).unwrap();
|
|
PluginMessageServerbound {
|
|
channel: "MC|Brand".into(),
|
|
data,
|
|
}
|
|
}
|
|
|
|
// TODO: cleanup this duplication for 1.7, return either message dynamically
|
|
pub fn as_message17(self) -> PluginMessageServerbound_i16 {
|
|
let mut data = vec![];
|
|
Serializable::write_to(&self.brand, &mut data).unwrap();
|
|
PluginMessageServerbound_i16 {
|
|
channel: "MC|Brand".into(),
|
|
data: crate::protocol::LenPrefixedBytes::<i16>::new(data),
|
|
}
|
|
}
|
|
|
|
}
|