diff options
Diffstat (limited to 'azalea-client/src/inventory.rs')
| -rw-r--r-- | azalea-client/src/inventory.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/azalea-client/src/inventory.rs b/azalea-client/src/inventory.rs index b7269ef1..25ce157e 100644 --- a/azalea-client/src/inventory.rs +++ b/azalea-client/src/inventory.rs @@ -14,13 +14,13 @@ use azalea_protocol::packets::game::{ serverbound_container_close_packet::ServerboundContainerClosePacket, }; use azalea_registry::MenuKind; -use bevy_app::{App, Plugin}; +use bevy_app::{App, Plugin, Update}; use bevy_ecs::{ component::Component, entity::Entity, event::EventReader, - prelude::EventWriter, - schedule::{IntoSystemConfig, IntoSystemConfigs}, + prelude::{Event, EventWriter}, + schedule::IntoSystemConfigs, system::Query, }; use log::warn; @@ -36,6 +36,7 @@ impl Plugin for InventoryPlugin { .add_event::<ContainerClickEvent>() .add_event::<SetContainerContentEvent>() .add_systems( + Update, ( handle_menu_opened_event, handle_set_container_content_event, @@ -563,7 +564,7 @@ impl Default for InventoryComponent { /// Sent from the server when a menu (like a chest or crafting table) was /// opened by the client. -#[derive(Debug)] +#[derive(Event, Debug)] pub struct MenuOpenedEvent { pub entity: Entity, pub window_id: u32, @@ -585,6 +586,7 @@ fn handle_menu_opened_event( /// /// Note that this is also sent when the client closes its own inventory, even /// though there is no packet for opening its inventory. +#[derive(Event)] pub struct CloseContainerEvent { pub entity: Entity, /// The ID of the container to close. 0 for the player's inventory. If this @@ -621,6 +623,7 @@ fn handle_container_close_event( /// Close a container without notifying the server. /// /// Note that this also gets fired when we get a [`CloseContainerEvent`]. +#[derive(Event)] pub struct ClientSideCloseContainerEvent { pub entity: Entity, } @@ -635,7 +638,7 @@ pub fn handle_client_side_close_container_event( } } -#[derive(Debug)] +#[derive(Event, Debug)] pub struct ContainerClickEvent { pub entity: Entity, pub window_id: u8, @@ -687,6 +690,7 @@ pub fn handle_container_click_event( /// Sent from the server when the contents of a container are replaced. Usually /// triggered by the `ContainerSetContent` packet. +#[derive(Event)] pub struct SetContainerContentEvent { pub entity: Entity, pub slots: Vec<ItemSlot>, |
