Throw a burst of spit particles when a llama spits
This commit is contained in:
@@ -1013,6 +1013,11 @@ impl Game<'_> {
|
||||
self.next_entity += 1;
|
||||
p.id = self.next_entity;
|
||||
let (owner, at) = (p.owner, [p.position.x, p.position.y, p.position.z]);
|
||||
// LlamaSpit.recreateFromPacket: the spit's burst on the client.
|
||||
if p.kind == ProjectileKind::LlamaSpit {
|
||||
let v = p.velocity;
|
||||
self.particles.llama_spit_burst(at, [v.x, v.y, v.z]);
|
||||
}
|
||||
self.creatures.projectiles.push(p);
|
||||
self.projectile_event("minecraft:projectile_shoot", owner, at);
|
||||
}
|
||||
|
||||
@@ -161,6 +161,10 @@ impl Game<'_> {
|
||||
let Some(k) = projectile_kind(kind) else {
|
||||
return false;
|
||||
};
|
||||
if k == ProjectileKind::LlamaSpit {
|
||||
self.particles
|
||||
.llama_spit_burst(position, [velocity.x, velocity.y, velocity.z]);
|
||||
}
|
||||
let mut p = Projectile::new(k, at, None);
|
||||
p.id = id;
|
||||
p.velocity = velocity;
|
||||
|
||||
@@ -1398,6 +1398,18 @@ impl ParticleEngine {
|
||||
self.add(&ParticleOptions::simple(ty), center, [1.0, 0.0, 0.0]);
|
||||
self.explosion_blocks(center, radius, block_count, is_air);
|
||||
}
|
||||
/// `LlamaSpit.recreateFromPacket`: seven spit particles thrown ahead of a
|
||||
/// new spit, each faster than the last along x and z.
|
||||
pub fn llama_spit_burst(&mut self, at: [f64; 3], movement: [f64; 3]) {
|
||||
for i in 0..7 {
|
||||
let k = 0.4 + 0.1 * f64::from(i);
|
||||
self.add(
|
||||
&ParticleOptions::simple(ParticleType::Spit),
|
||||
at,
|
||||
[movement[0] * k, movement[1], movement[2] * k],
|
||||
);
|
||||
}
|
||||
}
|
||||
/// `ClientExplosionTracker` with `Level.DEFAULT_EXPLOSION_BLOCK_PARTICLES`.
|
||||
pub fn explosion_blocks(
|
||||
&mut self,
|
||||
|
||||
Reference in New Issue
Block a user