Merge pull request #2728 from kacpherek/fix/2715-riptide
🤖 Agent: Merged by Ludovic's AI agent (Claude, contrib-gate-19) after the contribution gate. Checked against vanilla 26.3 and proven in union/cg19-r2 (all round-2 PRs together: clippy, 1722 tests, 135 harnesses, lan_e2e in-frame and on the server thread) and union/cg19-r3 (the same PRs merged with today's main: 96/96 harnesses). Thanks @kacpherek.
This commit is contained in:
@@ -6143,7 +6143,18 @@ impl horizon_client::interaction_input::InteractionWorld for RemoteInputWorld<'_
|
||||
direction: 0,
|
||||
sequence: 0,
|
||||
}));
|
||||
self.0.using = None;
|
||||
// MultiPlayerGameMode.releaseUsingItem also runs `Item.releaseUsing` here: the
|
||||
// player moves by itself, so a Riptide launch happens on the client.
|
||||
let hand = self.0.used_hand();
|
||||
if let Some((slot, ticks)) = self.0.using.take()
|
||||
&& let Some(hand) = hand
|
||||
&& self
|
||||
.0
|
||||
.stack_in(slot)
|
||||
.is_some_and(|s| &*s.item == "minecraft:trident")
|
||||
{
|
||||
self.0.with_hand(hand, |g| g.release_trident(ticks));
|
||||
}
|
||||
}
|
||||
fn start_attack(&mut self) -> bool {
|
||||
self.0.remote_start_attack()
|
||||
|
||||
@@ -306,7 +306,12 @@ impl Game<'_> {
|
||||
if !self.in_water_or_rain() || self.riding.is_some() {
|
||||
return;
|
||||
}
|
||||
self.hurt_held_without_breaking(1);
|
||||
// `hurtWithoutBreaking` and the sound belong to the server; a server's
|
||||
// client only launches.
|
||||
let server_client = self.remote.is_some();
|
||||
if !server_client {
|
||||
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);
|
||||
@@ -339,8 +344,14 @@ impl Game<'_> {
|
||||
p.position.y += moved.y;
|
||||
}
|
||||
}
|
||||
let sound = format!("minecraft:item.trident.riptide_{}", riptide.min(3));
|
||||
self.audio.play(&sound, at, 1.0, 1.0);
|
||||
if !server_client {
|
||||
let sound = format!("minecraft:item.trident.riptide_{}", riptide.min(3));
|
||||
self.audio.play(&sound, at, 1.0, 1.0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// The server throws the trident.
|
||||
if self.remote.is_some() {
|
||||
return;
|
||||
}
|
||||
// hurtWithoutBreaking (Unbreaking applies), then the thrown copy.
|
||||
|
||||
Reference in New Issue
Block a user