From 467277ef6d70de648f45ce6c66409b28644d796e Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Sun, 25 Oct 2026 15:21:53 +0100 Subject: [PATCH] Update comparators when a guest changes a chest through its menu A container click from a server-thread or LAN player wrote the slots but never called BlockEntity.setChanged, so comparators kept the old output. Notify the block entity when the click changed the container's slots. --- crates/horizon-client/src/game/lan_actions.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/horizon-client/src/game/lan_actions.rs b/crates/horizon-client/src/game/lan_actions.rs index 2c7019c73..8da418271 100644 --- a/crates/horizon-client/src/game/lan_actions.rs +++ b/crates/horizon-client/src/game/lan_actions.rs @@ -1075,7 +1075,20 @@ impl Game<'_> { } S::ContainerClick(p) => { let rules = ItemRules(self.res.items()); + let slots = host.hub.guests[gi] + .menu + .as_ref() + .filter(|m| m.window == p.container) + .map(|m| m.slots); + let before = slots.and_then(|s| s.read(&self.world, &host.hub.guests[gi])); let drops = host.hub.container_click(conn, &p, &mut self.world, &rules); + // A click that changed the container's slots: BlockEntity.setChanged, + // so comparators read it again (a double chest's other half follows). + if let Some(Slots::Block(key) | Slots::Double(key, _)) = slots + && slots.and_then(|s| s.read(&self.world, &host.hub.guests[gi])) != before + { + self.container_changed(key); + } self.drop_guest_items(host, gi, drops); } S::ContainerClose(p) => {