add clientbound packet: CCloseContainer
This commit is contained in:
3 files changed
+27
-1
No files matched your search
@@ -0,0 +1,16 @@
|
|||||||
|
use serde::Serialize;
|
||||||
|
use pumpkin_macros::packet;
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
#[packet(0x12)]
|
||||||
|
pub struct CCloseContainer {
|
||||||
|
window_id: u8
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CCloseContainer {
|
||||||
|
pub const fn new(window_id: u8) -> Self {
|
||||||
|
Self {
|
||||||
|
window_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,6 +36,7 @@ mod c_update_entity_pos;
|
|||||||
mod c_update_entity_rot;
|
mod c_update_entity_rot;
|
||||||
mod c_worldevent;
|
mod c_worldevent;
|
||||||
mod player_action;
|
mod player_action;
|
||||||
|
mod c_close_container;
|
||||||
|
|
||||||
pub use c_acknowledge_block::*;
|
pub use c_acknowledge_block::*;
|
||||||
pub use c_actionbar::*;
|
pub use c_actionbar::*;
|
||||||
@@ -75,3 +76,4 @@ pub use c_update_entity_pos::*;
|
|||||||
pub use c_update_entity_rot::*;
|
pub use c_update_entity_rot::*;
|
||||||
pub use c_worldevent::*;
|
pub use c_worldevent::*;
|
||||||
pub use player_action::*;
|
pub use player_action::*;
|
||||||
|
pub use c_close_container::*;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
use pumpkin_core::text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
use pumpkin_inventory::WindowType;
|
use pumpkin_inventory::WindowType;
|
||||||
use pumpkin_protocol::client::play::{COpenScreen, CSetContainerContent, CSetContainerSlot};
|
use pumpkin_protocol::client::play::{CCloseContainer, COpenScreen, CSetContainerContent, CSetContainerSlot};
|
||||||
use pumpkin_protocol::slot::Slot;
|
use pumpkin_protocol::slot::Slot;
|
||||||
use pumpkin_world::item::Item;
|
use pumpkin_world::item::Item;
|
||||||
|
|
||||||
@@ -82,4 +82,12 @@ impl super::Client {
|
|||||||
&item.into(),
|
&item.into(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The official Minecraft client is weird, and will always just close *any* window that is opened when this gets sent
|
||||||
|
pub fn close_container(
|
||||||
|
&mut self,
|
||||||
|
window_type: WindowType
|
||||||
|
) {
|
||||||
|
self.send_packet(&CCloseContainer::new(window_type as u8))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user