Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle clicks outside inventory and non modifying clicks #661

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions crates/valence_inventory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ fn handle_click_slot(
continue;
}

if pkt.slot_idx < 0 && pkt.mode == ClickMode::Click {
if pkt.slot_idx == -999 && pkt.mode == ClickMode::Click {
// The client is dropping the cursor item by clicking outside the window.

let stack = std::mem::take(&mut cursor_item.0);
Expand Down Expand Up @@ -926,6 +926,10 @@ fn handle_click_slot(

continue;
}
if pkt.slot_idx == -999 {
// The player was just clicking outside the inventories without holding an item
continue;
}

if (0_i16..target_inventory.slot_count() as i16).contains(&pkt.slot_idx) {
// The player is dropping an item from another inventory.
Expand Down Expand Up @@ -1014,7 +1018,10 @@ fn handle_click_slot(
});
continue;
}

if pkt.slot_idx == -999 {
// The player was just clicking outside the inventories without holding an item
continue;
}
let stack = client_inv.slot(pkt.slot_idx as u16);

if !stack.is_empty() {
Expand Down
Loading
Loading