fix(mobs): a guest's tool breaking reaches the other clients

`LivingEntity.onEquippedItemBroken` broadcasts the equipment-break event for
the hand, so every client plays the break and its crumbs. A guest's tool
breaks on the host (`Game::damage_held` acting for the guest), and until now
nothing told the other clients: it was heard only by the window that
happened to be simulating. The break now goes through
`Game::lan_entity_event` with `equipment_break_event(MainHand)` (47).

Co-Authored-By: DeepSeek Harness (deepseek-v4.1-flash) <[email protected]>
This commit is contained in:
sirrayiandDeepSeek Harness committed 2026-10-31 18:43:52 +00:00
1 parent 92bc5e7728
commit 3d5138cfd6
2 files changed
+18 -1

No files matched your search

+17
View File
@@ -11827,6 +11827,23 @@ impl Game<'_> {
}
// LivingEntity.breakItem: the broken item's five crumbs.
self.eat_particles(&gone, 5);
// LivingEntity.onEquippedItemBroken: the level broadcasts the
// break event for the hand, so a guest's tool breaking on the
// host reaches every client (`ServerPlayer`'s own break is
// broadcast too, this window's included).
let guest = self.lan_acting.and_then(|conn| {
self.lan
.as_ref()
.and_then(|host| host.hub.guests.iter().find(|g| g.conn == conn))
.map(|g| g.entity_id)
});
if let Some(entity) = guest {
let event = horizon_client::mobs::item_break::equipment_break_event(
horizon_world::player_inventory::EquipmentSlot::MainHand,
);
let at = self.eye_position().unwrap_or([0.0; 3]);
self.lan_entity_event(entity, event, at);
}
}
}
}
+1 -1
View File
@@ -95,7 +95,7 @@ LivingEntity.getLocalBoundsForPose missing minor: no pose boxes; a dismounting
LivingEntity.wouldNotSuffocateAtTargetPose port crates/horizon-client/src/pose.rs::MotionWorld::can_fit_pose gap: minor: the player's poses only; a camel changing pose is not checked
LivingEntity.canUsePortal port crates/horizon-client/src/game/nether_portal.rs::Game::mob_can_use_portal gap: minor: a sleeping mob is not excluded
LivingEntity.setPosToBed port crates/horizon-client/src/mobs/villager.rs::start_sleeping x and z at the bed's centre, y 0.6875 above its base (sleep height plus 0.125)
LivingEntity.entityEventForEquipmentBreak inline crates/horizon-client/src/game/creatures.rs::Game::hurt_mob_armor a mob's worn armour that breaks from a hit broadcasts 49 to 52 (armour) and 65 (body); the player's own hands (47, 48), the saddle (68) and a guest's tool breaking on the host are not broadcast yet
LivingEntity.entityEventForEquipmentBreak inline crates/horizon-client/src/game/creatures.rs::Game::hurt_mob_armor a mob's worn armour breaking from a hit broadcasts 49 to 52 and 65, and a guest's held tool breaking on the host broadcasts 47; the saddle (68), the off hand (48) and a host's own tool an open world's guests should hear are not broadcast yet
LivingEntity.onEquippedItemBroken inline crates/horizon-client/src/game.rs::Game::damage_held gap: minor: the stack is cleared and modifiers rebuilt, but no break event is broadcast
LivingEntity.stopLocationBasedEffects inline crates/horizon-client/src/game.rs::Game::apply_equipment all applied modifiers are dropped and re-added from what is worn
LivingEntity.getEquipmentSlotForItem inline crates/horizon-client/src/game/mob_gear.rs::Game::equip_from_table resolveSlot: the item's equip_slot, else the main hand
1 Interaction.defineSynchedData port crates/horizon-client/src/game/interactions.rs::RemoteInteraction::new width 1.0, height 1.0, response false
95 LivingEntity.wouldNotSuffocateAtTargetPose port crates/horizon-client/src/pose.rs::MotionWorld::can_fit_pose gap: minor: the player's poses only; a camel changing pose is not checked
96 LivingEntity.canUsePortal port crates/horizon-client/src/game/nether_portal.rs::Game::mob_can_use_portal gap: minor: a sleeping mob is not excluded
97 LivingEntity.setPosToBed port crates/horizon-client/src/mobs/villager.rs::start_sleeping x and z at the bed's centre, y 0.6875 above its base (sleep height plus 0.125)
98 LivingEntity.entityEventForEquipmentBreak inline crates/horizon-client/src/game/creatures.rs::Game::hurt_mob_armor a mob's worn armour that breaks from a hit broadcasts 49 to 52 (armour) and 65 (body); the player's own hands (47, 48), the saddle (68) and a guest's tool breaking on the host are not broadcast yet a mob's worn armour breaking from a hit broadcasts 49 to 52 and 65, and a guest's held tool breaking on the host broadcasts 47; the saddle (68), the off hand (48) and a host's own tool an open world's guests should hear are not broadcast yet
99 LivingEntity.onEquippedItemBroken inline crates/horizon-client/src/game.rs::Game::damage_held gap: minor: the stack is cleared and modifiers rebuilt, but no break event is broadcast
100 LivingEntity.stopLocationBasedEffects inline crates/horizon-client/src/game.rs::Game::apply_equipment all applied modifiers are dropped and re-added from what is worn
101 LivingEntity.getEquipmentSlotForItem inline crates/horizon-client/src/game/mob_gear.rs::Game::equip_from_table resolveSlot: the item's equip_slot, else the main hand