Add Clientbound Game Event
This commit is contained in:
parent
1f041cc7db
commit
cc527c26ea
@ -168,4 +168,22 @@ impl ClientPacket for CLogin {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct CGameEvent {
|
||||
event: u8,
|
||||
value: f32,
|
||||
}
|
||||
|
||||
impl CGameEvent {
|
||||
pub fn new(event: u8, value: f32) -> Self {
|
||||
Self { event, value }
|
||||
}
|
||||
}
|
||||
|
||||
impl ClientPacket for CGameEvent {
|
||||
const PACKET_ID: VarInt = 0x22;
|
||||
|
||||
fn write(&self, bytebuf: &mut ByteBuffer) {
|
||||
bytebuf.put_u8(self.event);
|
||||
bytebuf.put_f32(self.value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ use mio::{event::Event, Poll};
|
||||
use pumpkin_protocol::{
|
||||
client::{
|
||||
config::CPluginMessage,
|
||||
play::{ CLogin},
|
||||
play::{CGameEvent, CLogin},
|
||||
},
|
||||
PacketError, Players, Sample, StatusResponse, VarInt, VarInt32, Version,
|
||||
};
|
||||
@ -127,7 +127,10 @@ impl Server {
|
||||
))
|
||||
.unwrap_or_else(|e| client.kick(&e.to_string()));
|
||||
|
||||
|
||||
// Start waiting for level chunks
|
||||
client
|
||||
.send_packet(CGameEvent::new(13, 0.0))
|
||||
.unwrap_or_else(|e| client.kick(&e.to_string()));
|
||||
dbg!("spawning player");
|
||||
client.player = Some(player);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user