From 4d0116762c9a360490cc5c65510f9fd5b552b8b9 Mon Sep 17 00:00:00 2001 From: Kacpherek Date: Mon, 26 Oct 2026 13:48:08 +0100 Subject: [PATCH] Apply Unbreaking to thrown tridents and stop Riptide while riding Throwing a trident now wears it through the same durability path as Riptide, so Unbreaking applies, and it still never breaks the trident. Riptide no longer launches a player who is riding something. --- crates/horizon-client/src/game.rs | 18 ++++++++++++++++++ crates/horizon-client/src/game/trident.rs | 13 +++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index b397882cd..390befe40 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -8660,6 +8660,24 @@ impl Game<'_> { } } } + /// `ItemStack.hurtWithoutBreaking`: Unbreaking applies, but the stack stops at + /// one point of durability left instead of breaking. + fn hurt_held_without_breaking(&mut self, amount: u32) { + if self.creative { + return; + } + let Some(held) = self.held().cloned() else { + return; + }; + let amount = self.durability_loss(&held, amount); + let max = self.res.items().get(&held.item).map_or(0, |i| i.max_damage); + if amount == 0 || max == 0 { + return; + } + if let Some(stack) = self.held_mut().as_mut() { + stack.damage = (stack.damage + amount).min(max - 1); + } + } /// Block tool use: distinguish success, failure and fall-through for hand feedback. fn use_tool( &mut self, diff --git a/crates/horizon-client/src/game/trident.rs b/crates/horizon-client/src/game/trident.rs index c31094596..af77ac50f 100644 --- a/crates/horizon-client/src/game/trident.rs +++ b/crates/horizon-client/src/game/trident.rs @@ -171,10 +171,11 @@ impl Game<'_> { .as_ref() .map(|p| [p.position.x, p.position.y, p.position.z]); if riptide > 0 { - if !self.in_water_or_rain() { + // `isInWaterOrRain() && !isPassenger()`. + if !self.in_water_or_rain() || self.riding.is_some() { return; } - self.damage_held(1); + self.hurt_held_without_breaking(1); // trident_spin_attack_strength: 1.5 + 0.75 per level above the first. let strength = 1.5 + 0.75 * (riptide as f32 - 1.0); let d = view_vector(self.yaw, self.pitch); @@ -195,12 +196,8 @@ impl Game<'_> { self.audio.play(&sound, at, 1.0, 1.0); return; } - // hurtWithoutBreaking, then the thrown copy. - if !self.creative - && let Some(s) = self.held_mut().as_mut() - { - s.damage += 1; - } + // hurtWithoutBreaking (Unbreaking applies), then the thrown copy. + self.hurt_held_without_breaking(1); let thrown = self.held().cloned().unwrap_or(stack); if !self.creative { *self.held_mut() = None;