add serverbound packet SContainerClose
This commit is contained in:
parent
e1a7d4e7ee
commit
ef21b3ae40
@ -1,7 +1,7 @@
|
|||||||
use pumpkin_macros::packet;
|
use pumpkin_macros::packet;
|
||||||
use serde::Serialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Deserialize)]
|
||||||
#[packet(0x0F)]
|
#[packet(0x0F)]
|
||||||
pub struct SCloseContainer {
|
pub struct SCloseContainer {
|
||||||
pub window_id: u8,
|
pub window_id: u8,
|
||||||
|
|||||||
@ -28,8 +28,8 @@ use pumpkin_protocol::{
|
|||||||
handshake::SHandShake,
|
handshake::SHandShake,
|
||||||
login::{SEncryptionResponse, SLoginAcknowledged, SLoginPluginResponse, SLoginStart},
|
login::{SEncryptionResponse, SLoginAcknowledged, SLoginPluginResponse, SLoginStart},
|
||||||
play::{
|
play::{
|
||||||
SChatCommand, SChatMessage, SClientInformationPlay, SConfirmTeleport, SInteract,
|
SChatCommand, SChatMessage, SClientInformationPlay, SCloseContainer, SConfirmTeleport,
|
||||||
SPlayPingRequest, SPlayerAction, SPlayerCommand, SPlayerPosition,
|
SInteract, SPlayPingRequest, SPlayerAction, SPlayerCommand, SPlayerPosition,
|
||||||
SPlayerPositionRotation, SPlayerRotation, SSetCreativeSlot, SSetHeldItem, SSwingArm,
|
SPlayerPositionRotation, SPlayerRotation, SSetCreativeSlot, SSetHeldItem, SSwingArm,
|
||||||
SUseItemOn,
|
SUseItemOn,
|
||||||
},
|
},
|
||||||
@ -312,6 +312,9 @@ impl Client {
|
|||||||
SPlayPingRequest::PACKET_ID => {
|
SPlayPingRequest::PACKET_ID => {
|
||||||
self.handle_play_ping_request(server, SPlayPingRequest::read(bytebuf).unwrap())
|
self.handle_play_ping_request(server, SPlayPingRequest::read(bytebuf).unwrap())
|
||||||
}
|
}
|
||||||
|
SCloseContainer::PACKET_ID => {
|
||||||
|
self.handle_close_container(server, SCloseContainer::read(bytebuf).unwrap())
|
||||||
|
}
|
||||||
_ => log::error!("Failed to handle player packet id {:#04x}", packet.id.0),
|
_ => log::error!("Failed to handle player packet id {:#04x}", packet.id.0),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -420,7 +420,7 @@ impl Client {
|
|||||||
// TODO:
|
// TODO:
|
||||||
// This function will in the future be used to keep track of if the client is in a valid state.
|
// This function will in the future be used to keep track of if the client is in a valid state.
|
||||||
// But this is not possible yet
|
// But this is not possible yet
|
||||||
pub fn handle_close_container(&mut self, packet: SCloseContainer) {
|
pub fn handle_close_container(&mut self, _server: &mut Server, packet: SCloseContainer) {
|
||||||
// window_id 0 represents both 9x1 Generic AND inventory here
|
// window_id 0 represents both 9x1 Generic AND inventory here
|
||||||
let Ok(_window_type) = WindowType::try_from(packet.window_id) else {
|
let Ok(_window_type) = WindowType::try_from(packet.window_id) else {
|
||||||
self.kick("Invalid window ID");
|
self.kick("Invalid window ID");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user