From b242a5ac150ad2780d548a4b3f9fb85605e9a425 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Mon, 26 Oct 2026 15:40:50 +0100 Subject: [PATCH] Give the stacks inside a sent item their own ids Hub::stack resolved every item id of a stack to the outer item's, so a bundle's contents and a crossbow's charged projectiles reached a server's clients as more bundles and crossbows. The tooltip then drew a bundle of bundles, full. Each stack inside now looks its own id up. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/lan/hub.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/crates/horizon-client/src/lan/hub.rs b/crates/horizon-client/src/lan/hub.rs index b462536b9..a9a1277e1 100644 --- a/crates/horizon-client/src/lan/hub.rs +++ b/crates/horizon-client/src/lan/hub.rs @@ -371,9 +371,21 @@ impl Hub { id } pub fn stack(&mut self, s: &Option) -> Option { - let id = s.as_ref().map(|s| self.item_id(&s.item))?; + let item = s.as_ref()?.item.clone(); + let id = self.item_id(&item); let sync = self.sync.clone(); - stack_to_network(|_| id, |registry, name| sync.id(registry, name), s) + // The stacks inside it (a bundle's contents, a crossbow's projectiles) + // have ids of their own. + let item_id = |name: &str| { + if name == &*item { + return id; + } + sync.builtin + .get("minecraft:item") + .and_then(|i| i.id(name)) + .unwrap_or(0) + }; + stack_to_network(item_id, |registry, name| sync.id(registry, name), s) } pub fn broadcast(&self, packet: &C) {