mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-10 02:21:33 -10:00
Pufferfish sting: drop the end-of-tick arm apply_brain_events now replaces
Every PufferfishSting comes from a mob's tick (sting_touching_mobs), and apply_brain_events consumes it right after that tick, so handle_mob_events' mob_hits_mob arm could no longer run. It joins StartFollowing and SchoolSize. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
d49eb54168
commit
82648da3f3
1 file changed
+3
-29
@@ -2396,34 +2396,6 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
}
|
||||
MobEvent::PufferfishSting {
|
||||
mob,
|
||||
target,
|
||||
amount,
|
||||
source,
|
||||
poison_ticks,
|
||||
} => {
|
||||
// Pufferfish.touch: the poison and
|
||||
// `playSound(PUFFER_FISH_STING, 1, 1)` sit inside the
|
||||
// `hurtServer` branch, so only a hit that landed poisons
|
||||
// and stings, at the fish's own position as
|
||||
// `Entity.playSound` puts it, and not when it is silent.
|
||||
let landed = self.mob_hits_mob(target, amount, source);
|
||||
if landed && let Some(t) = self.mobs.iter_mut().find(|m| m.id == target) {
|
||||
t.add_effect("minecraft:poison", poison_ticks, 0);
|
||||
}
|
||||
if landed && let Some(m) = self.mobs.iter_mut().find(|m| m.id == mob) {
|
||||
let at = [m.position.x, m.position.y, m.position.z];
|
||||
if !m.silent {
|
||||
self.handle_mob_events(vec![MobEvent::Sound(
|
||||
"entity.puffer_fish.sting",
|
||||
at,
|
||||
1.0,
|
||||
1.0,
|
||||
)])?;
|
||||
}
|
||||
}
|
||||
}
|
||||
MobEvent::SonicBoom {
|
||||
target,
|
||||
attacker,
|
||||
@@ -3001,7 +2973,9 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
// Applied after the fish's tick (`apply_brain_events`).
|
||||
MobEvent::StartFollowing { .. } | MobEvent::SchoolSize { .. } => {}
|
||||
MobEvent::StartFollowing { .. }
|
||||
| MobEvent::SchoolSize { .. }
|
||||
| MobEvent::PufferfishSting { .. } => {}
|
||||
MobEvent::LeashBreak { mob, drop, sound } => self.break_leash(mob, drop, sound),
|
||||
MobEvent::NotifyLeashHolder { holder } => {
|
||||
if let Some(m) = self.mobs.iter_mut().find(|m| m.id == holder) {
|
||||
|
||||
Reference in new issue
Block a user