From 4b9a21decab028f9c76b2b0beb1745e65a758bdb Mon Sep 17 00:00:00 2001 From: maxomatic458 <104733404+maxomatic458@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:40:32 +0200 Subject: [PATCH] ignore client nbt for hotbar click --- crates/valence_inventory/src/validate.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/valence_inventory/src/validate.rs b/crates/valence_inventory/src/validate.rs index b34c75b9c..1aa4a3c59 100644 --- a/crates/valence_inventory/src/validate.rs +++ b/crates/valence_inventory/src/validate.rs @@ -291,13 +291,17 @@ pub(super) fn validate_click_slot_packet( window.slot(packet.slot_changes[0].idx as u16), window.slot(packet.slot_changes[1].idx as u16), ]; + // There are some cases where the client will add NBT data that did not + // previously exist. ensure!( old_slots .iter() - .any(|s| *s == &packet.slot_changes[0].stack) + .any(|s| s.item == packet.slot_changes[0].stack.item + && s.count == packet.slot_changes[0].stack.count) && old_slots .iter() - .any(|s| *s == &packet.slot_changes[1].stack), + .any(|s| s.item == packet.slot_changes[1].stack.item + && s.count == packet.slot_changes[1].stack.count), "swapped items must match" ); }