From db94ce78a3622045a32bbfa040ce45ff6e58ba04 Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Tue, 6 Jun 2023 10:26:11 -0400 Subject: [PATCH] only allow ClickMode::Click --- crates/valence_inventory/src/menu.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/valence_inventory/src/menu.rs b/crates/valence_inventory/src/menu.rs index 41acf16..8868cc9 100644 --- a/crates/valence_inventory/src/menu.rs +++ b/crates/valence_inventory/src/menu.rs @@ -11,7 +11,7 @@ use valence_core::protocol::encode::WritePacket; use valence_core::text::Text; use crate::packet::{ - ClickSlotC2s, InventoryS2c, OpenScreenS2c, ScreenHandlerSlotUpdateS2c, WindowType, + ClickMode, ClickSlotC2s, InventoryS2c, OpenScreenS2c, ScreenHandlerSlotUpdateS2c, WindowType, }; use crate::{ validate, ClickSlot, ClientInventoryState, CursorItem, DropItemStack, Inventory, InventoryKind, @@ -52,6 +52,9 @@ fn handle_click_slot( mut inventories: Query<&mut Inventory, (Without, With)>, ) { for click in clicks.iter() { + if click.mode != ClickMode::Click { + continue; + } println!("menu click: {:?}", click); if let Ok((mut client, mut inv, mut inv_state, mut cursor_item, open_inv)) = clients.get_mut(click.client)