use of io.xol.chunkstories.net.packets.PacketSoundSource in project chunkstories by Hugobros3.
the class VirtualSoundManager method updateSourceForEveryone.
public void updateSourceForEveryone(SoundSourceVirtual soundSource, ServerPlayerVirtualSoundManager exceptHim) {
// Create the update packet
PacketSoundSource packet = new PacketSoundSource(worldServer, soundSource);
Iterator<ServerPlayerVirtualSoundManager> i = playersSoundManagers.iterator();
while (i.hasNext()) {
ServerPlayerVirtualSoundManager playerSoundManager = i.next();
// Send it to all players than could hear it
if (exceptHim == null || !playerSoundManager.equals(exceptHim)) {
if (!playerSoundManager.couldHearSource(soundSource))
continue;
// Updates the soundSource
playerSoundManager.serverPlayer.pushPacket(packet);
}
}
}
use of io.xol.chunkstories.net.packets.PacketSoundSource in project chunkstories by Hugobros3.
the class VirtualSoundManager method addSourceToEveryone.
private void addSourceToEveryone(SoundSourceVirtual soundSource, ServerPlayerVirtualSoundManager exceptHim) {
// Create the sound creation packet
PacketSoundSource packet = new PacketSoundSource(worldServer, soundSource);
Iterator<ServerPlayerVirtualSoundManager> i = playersSoundManagers.iterator();
while (i.hasNext()) {
ServerPlayerVirtualSoundManager playerSoundManager = i.next();
// Send it to all players than could hear it
if (exceptHim == null || !playerSoundManager.equals(exceptHim)) {
if (!playerSoundManager.couldHearSource(soundSource))
continue;
// Creates the soundSource and adds it weakly to the player's list
playerSoundManager.serverPlayer.pushPacket(packet);
// TODO maybe not relevant since for updating we iterate over all players then do a distance check
playerSoundManager.addSourceToPlayer(soundSource);
}
}
allPlayingSoundSources.add(new WeakReference<SoundSourceVirtual>(soundSource));
}
Aggregations