Format the mob sound changes
This commit is contained in:
@@ -378,7 +378,12 @@ pub fn play_step(
|
|||||||
m.ai.steps.gallop += 1;
|
m.ai.steps.gallop += 1;
|
||||||
let count = m.ai.steps.gallop;
|
let count = m.ai.steps.gallop;
|
||||||
if count > 5 && count % 3 == 0 {
|
if count > 5 && count % 3 == 0 {
|
||||||
events.push(MobEvent::Sound("entity.horse.gallop", at, volume * 0.15, pitch));
|
events.push(MobEvent::Sound(
|
||||||
|
"entity.horse.gallop",
|
||||||
|
at,
|
||||||
|
volume * 0.15,
|
||||||
|
pitch,
|
||||||
|
));
|
||||||
// Horse.playGallopSound: now and then it breathes too.
|
// Horse.playGallopSound: now and then it breathes too.
|
||||||
if m.species() == Species::Horse && m.random.next_int_bound(10).unwrap_or(1) == 0 {
|
if m.species() == Species::Horse && m.random.next_int_bound(10).unwrap_or(1) == 0 {
|
||||||
let breathe = if baby {
|
let breathe = if baby {
|
||||||
@@ -389,10 +394,20 @@ pub fn play_step(
|
|||||||
events.push(MobEvent::Sound(breathe, at, volume * 0.6, pitch));
|
events.push(MobEvent::Sound(breathe, at, volume * 0.6, pitch));
|
||||||
}
|
}
|
||||||
} else if count <= 5 {
|
} else if count <= 5 {
|
||||||
events.push(MobEvent::Sound("entity.horse.step_wood", at, volume * 0.15, pitch));
|
events.push(MobEvent::Sound(
|
||||||
|
"entity.horse.step_wood",
|
||||||
|
at,
|
||||||
|
volume * 0.15,
|
||||||
|
pitch,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
} else if is_wood_sound_type(sound_type) {
|
} else if is_wood_sound_type(sound_type) {
|
||||||
events.push(MobEvent::Sound("entity.horse.step_wood", at, volume * 0.15, pitch));
|
events.push(MobEvent::Sound(
|
||||||
|
"entity.horse.step_wood",
|
||||||
|
at,
|
||||||
|
volume * 0.15,
|
||||||
|
pitch,
|
||||||
|
));
|
||||||
} else {
|
} else {
|
||||||
let step = if baby {
|
let step = if baby {
|
||||||
"entity.baby_horse.step"
|
"entity.baby_horse.step"
|
||||||
@@ -405,8 +420,14 @@ pub fn play_step(
|
|||||||
/// `AbstractHorse.isWoodSoundType`: WOOD, NETHER_WOOD, STEM, CHERRY_WOOD and
|
/// `AbstractHorse.isWoodSoundType`: WOOD, NETHER_WOOD, STEM, CHERRY_WOOD and
|
||||||
/// BAMBOO_WOOD (not HARD_CROP, which only shares WOOD's step).
|
/// BAMBOO_WOOD (not HARD_CROP, which only shares WOOD's step).
|
||||||
fn is_wood_sound_type(sounds: &horizon_items::blocks::Sounds) -> bool {
|
fn is_wood_sound_type(sounds: &horizon_items::blocks::Sounds) -> bool {
|
||||||
let step = sounds.step.strip_prefix("minecraft:").unwrap_or(&sounds.step);
|
let step = sounds
|
||||||
let place = sounds.place.strip_prefix("minecraft:").unwrap_or(&sounds.place);
|
.step
|
||||||
|
.strip_prefix("minecraft:")
|
||||||
|
.unwrap_or(&sounds.step);
|
||||||
|
let place = sounds
|
||||||
|
.place
|
||||||
|
.strip_prefix("minecraft:")
|
||||||
|
.unwrap_or(&sounds.place);
|
||||||
match step {
|
match step {
|
||||||
"block.wood.step" => place == "block.wood.place",
|
"block.wood.step" => place == "block.wood.place",
|
||||||
"block.nether_wood.step"
|
"block.nether_wood.step"
|
||||||
|
|||||||
Reference in New Issue
Block a user