Accidentally removed a cancel, don't bother sending our sound packets if we're not modifying the sound groups

This commit is contained in:
libraryaddict 2021-11-11 23:08:44 +13:00
parent e7b370733f
commit bc9ebac4d5

View file

@ -217,21 +217,21 @@ public class PacketListenerSounds extends PacketAdapter {
} }
} }
SoundGroup disSound = SoundGroup.getGroup(entity.getType().name()); SoundGroup entitySoundGroup = SoundGroup.getGroup(entity.getType().name());
if (disSound == null) { if (entitySoundGroup == null) {
return; return;
} }
Object sound = disSound.getSound(soundType); Object sound = entitySoundGroup.getSound(soundType);
if (sound == null) { if (sound == null) {
return; return;
} }
disSound = SoundGroup.getGroup(disguise); SoundGroup disSound = SoundGroup.getGroup(disguise);
if (disSound == null) { if (disSound == null || disSound == entitySoundGroup) {
return; return;
} }
@ -262,6 +262,7 @@ public class PacketListenerSounds extends PacketAdapter {
mods.write(6, pitch); mods.write(6, pitch);
event.setCancelled(true);
try { try {
ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, false); ProtocolLibrary.getProtocolManager().sendServerPacket(observer, packet, false);
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {