mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-10 02:21:33 -10:00
Crossbow mobs: draw the attack delay before the loading sound's pitch
Keeps the mob random stream's order from before this branch, so a pillager's or piglin's attack delays don't change for the same seed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
8c579c0ef1
commit
fa876269f3
1 file changed
+9
-7
@@ -564,19 +564,21 @@ impl Goal for CrossbowAttack {
|
||||
m.extra.using_item = 0;
|
||||
m.extra.flag = false;
|
||||
self.state = Crossbow::Charged;
|
||||
let weapon = m
|
||||
.extra
|
||||
.main_hand_stack()
|
||||
.cloned()
|
||||
.unwrap_or_else(|| ItemStack::new("minecraft:crossbow", 1));
|
||||
set_crossbow_charged(m, true);
|
||||
// The attack delay is drawn before the sound's pitch, as before.
|
||||
self.attack_delay = 20 + m.random.next_int_bound(20).unwrap_or(0);
|
||||
let pitch = 1.0 / (m.random.next_float() * 0.5 + 1.0) + 0.2;
|
||||
cx.events.push(MobEvent::CrossbowLoad {
|
||||
mob: m.id,
|
||||
at: m.center(),
|
||||
pitch,
|
||||
weapon: m
|
||||
.extra
|
||||
.main_hand_stack()
|
||||
.cloned()
|
||||
.unwrap_or_else(|| ItemStack::new("minecraft:crossbow", 1)),
|
||||
weapon,
|
||||
});
|
||||
set_crossbow_charged(m, true);
|
||||
self.attack_delay = 20 + m.random.next_int_bound(20).unwrap_or(0);
|
||||
}
|
||||
}
|
||||
Crossbow::Charged => {
|
||||
|
||||
Reference in new issue
Block a user