Another bug fixed?

This commit is contained in:
libraryaddict 2021-08-06 09:19:49 +12:00
parent e1c410781a
commit d20a8e5266

View File

@ -64,7 +64,7 @@ public class PacketListenerSounds extends PacketAdapter {
SoundType soundType = null; SoundType soundType = null;
Entity disguisedEntity = null; Entity disguisedEntity = null;
SoundGroup entitySound = null; SoundGroup soundGroup = null;
Object soundEffectObj = mods.read(0); Object soundEffectObj = mods.read(0);
Disguise disguise = null; Disguise disguise = null;
@ -93,16 +93,15 @@ public class PacketListenerSounds extends PacketAdapter {
disguise = entityDisguise; disguise = entityDisguise;
disguisedEntity = entity; disguisedEntity = entity;
entitySound = SoundGroup.getGroup(entity.getType().name()); soundGroup = SoundGroup.getGroup(entity.getType().name());
if (entitySound == null) { if (soundGroup.getSound(soundEffectObj) == null) {
event.setCancelled(true); return;
continue;
} }
if ((!(entity instanceof LivingEntity)) || ((LivingEntity) entity).getHealth() > 0) { if ((!(entity instanceof LivingEntity)) || ((LivingEntity) entity).getHealth() > 0) {
boolean hasInvun = ReflectionManager.hasInvul(entity); boolean hasInvun = ReflectionManager.hasInvul(entity);
soundType = entitySound.getType(soundEffectObj, !hasInvun); soundType = soundGroup.getType(soundEffectObj, !hasInvun);
} else { } else {
soundType = SoundType.DEATH; soundType = SoundType.DEATH;
} }
@ -143,7 +142,7 @@ public class PacketListenerSounds extends PacketAdapter {
float pitch = (float) mods.read(6); float pitch = (float) mods.read(6);
// If the volume is the default // If the volume is the default
if (volume == entitySound.getDamageAndIdleSoundVolume()) { if (volume == soundGroup.getDamageAndIdleSoundVolume()) {
volume = disguiseSound.getDamageAndIdleSoundVolume(); volume = disguiseSound.getDamageAndIdleSoundVolume();
} }