Fixed bat sound bug. Fixed unable to check if the sound is baby/adult
This commit is contained in:
parent
b34033d942
commit
573e307d19
@ -170,17 +170,32 @@ public class DisguiseAPI {
|
||||
mods.write(4, entitySound.getDamageSoundVolume());
|
||||
}
|
||||
// Here I assume its the default pitch as I can't calculate if its real.
|
||||
if (disguise instanceof MobDisguise
|
||||
&& disguisedEntity instanceof LivingEntity
|
||||
&& (((MobDisguise) disguise).isAdult() == ((CraftLivingEntity) disguisedEntity)
|
||||
.getHandle().isBaby())) {
|
||||
float pitch;
|
||||
if (disguise instanceof MobDisguise && !((MobDisguise) disguise).isAdult()) {
|
||||
if (disguise instanceof MobDisguise && disguisedEntity instanceof LivingEntity) {
|
||||
boolean baby = ((CraftLivingEntity) disguisedEntity).getHandle().isBaby();
|
||||
if (((MobDisguise) disguise).isAdult() == baby) {
|
||||
|
||||
float pitch = (Integer) mods.read(5);
|
||||
if (baby) {
|
||||
// If the pitch is not the expected
|
||||
if (pitch > 97 || pitch < 111)
|
||||
return;
|
||||
pitch = (new Random().nextFloat() - new Random().nextFloat()) * 0.2F + 1.5F;
|
||||
} else
|
||||
// Min = 1.5
|
||||
// Cap = 97.5
|
||||
// Max = 1.7
|
||||
// Cap = 110.5
|
||||
} else {
|
||||
// If the pitch is not the expected
|
||||
if (pitch >= 63 || pitch <= 76)
|
||||
return;
|
||||
pitch = (new Random().nextFloat() - new Random().nextFloat()) * 0.2F + 1.0F;
|
||||
// Min = 1
|
||||
// Cap = 63
|
||||
// Max = 1.2
|
||||
// Cap = 75.6
|
||||
}
|
||||
if (disguise.getType() == DisguiseType.BAT)
|
||||
pitch *= 95F;
|
||||
pitch *= 0.95F;
|
||||
pitch *= 63;
|
||||
if (pitch < 0)
|
||||
pitch = 0;
|
||||
@ -193,6 +208,7 @@ public class DisguiseAPI {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (event.getPacketID() == Packets.Server.ENTITY_STATUS) {
|
||||
if ((Byte) mods.read(1) == 2) {
|
||||
// It made a damage animation
|
||||
|
Loading…
Reference in New Issue
Block a user