aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/inventory.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2023-07-09 19:11:29 -0500
committerGitHub <noreply@github.com>2023-07-09 19:11:29 -0500
commitd1afd02aa84e7b4450c1607277f078eb2a0f1bf3 (patch)
treeefea9bb7ef7f2064f7c963fd88f394fecec6231b /azalea-client/src/inventory.rs
parentea8a8fccb6eb39c97f6cb69e11db5f7d0886172e (diff)
downloadazalea-drasl-d1afd02aa84e7b4450c1607277f078eb2a0f1bf3.tar.xz
Update to Bevy 0.11 (#94)
* update to bevy 0.11 * clippy --------- Co-authored-by: mat <git@matdoes.dev>
Diffstat (limited to 'azalea-client/src/inventory.rs')
-rw-r--r--azalea-client/src/inventory.rs14
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>,