Fix the baby zombie villager, happy ghast and player hurt voice pitch
This commit is contained in:
@@ -719,11 +719,6 @@ impl Audio {
|
||||
self.play(event, at, volume, pitch);
|
||||
self.capture = capture;
|
||||
}
|
||||
/// `LivingEntity.handleDamageEvent`'s pitch, `(r - r) * 0.2 + 1`, drawn on the
|
||||
/// client (the entity's own random there, never the server's world random).
|
||||
pub fn hurt_pitch(&mut self) -> f32 {
|
||||
(self.random.next_float() - self.random.next_float()) * 0.2 + 1.0
|
||||
}
|
||||
/// `AbstractWidget.playButtonClickSound`: an unseeded, relative UI sound.
|
||||
pub fn play_button_click(&mut self) {
|
||||
self.play_instance(
|
||||
|
||||
@@ -69,8 +69,8 @@ impl Game<'_> {
|
||||
/// `LivingEntity.handleDamageEvent` for the player: the hurt sound of the
|
||||
/// source's `DamageEffects` (`Player.getHurtSound`).
|
||||
pub(super) fn player_hurt_sound(&mut self, sound: &str, at: [f64; 3]) {
|
||||
let pitch = self.audio.hurt_pitch();
|
||||
self.audio.play(sound, Some(at), 1.0, pitch);
|
||||
// Player.getVoicePitch: always 1.0.
|
||||
self.audio.play(sound, Some(at), 1.0, 1.0);
|
||||
}
|
||||
/// `CombatTracker.recordDamage` for the motion events of this tick.
|
||||
pub(super) fn record_combat(&mut self, events: &[MotionEvent]) {
|
||||
|
||||
@@ -1968,8 +1968,18 @@ impl Mob {
|
||||
}
|
||||
/// LivingEntity.getVoicePitch.
|
||||
pub fn voice_pitch(&mut self) -> f32 {
|
||||
// HappyGhast.getVoicePitch: always 1.0, babies and all.
|
||||
if self.species() == Species::HappyGhast {
|
||||
return 1.0;
|
||||
}
|
||||
// ZombieVillager.getVoicePitch: babies are 2.0, not 1.5.
|
||||
let baby = if self.species() == Species::ZombieVillager {
|
||||
2.0
|
||||
} else {
|
||||
1.5
|
||||
};
|
||||
let pitch = (self.random.next_float() - self.random.next_float()) * 0.2
|
||||
+ if self.is_baby() { 1.5 } else { 1.0 };
|
||||
+ if self.is_baby() { baby } else { 1.0 };
|
||||
// Bat.getVoicePitch: a little lower.
|
||||
if self.species() == Species::Bat {
|
||||
pitch * 0.95
|
||||
|
||||
Reference in New Issue
Block a user