Search in sources :

Example 1 with TObjectFloatHashMap

use of gnu.trove.map.hash.TObjectFloatHashMap in project DynamicSurroundings by OreCruncher.

the class BiomeSoundEffectsHandler method process.

@Override
public void process(@Nonnull final EntityPlayer player) {
    this.biomes.update();
    final TObjectFloatHashMap<SoundEffect> sounds = new TObjectFloatHashMap<>(Constants.DEFAULT_CAPACITY, Constants.DEFAULT_LOAD_FACTOR, -1F);
    if (doBiomeSounds())
        getBiomeSounds(sounds);
    final ObjectArray<SoundEffect> playerSounds = new ObjectArray<>();
    ClientRegistry.BIOME.PLAYER_INFO.findSoundMatches(playerSounds);
    if (ModOptions.sound.enableBattleMusic)
        ClientRegistry.BIOME.BATTLE_MUSIC_INFO.findSoundMatches(playerSounds);
    if (EnvironState.inVillage())
        ClientRegistry.BIOME.VILLAGE_INFO.findSoundMatches(playerSounds);
    playerSounds.forEach(fx -> sounds.put(fx, 1.0F));
    SoundEffectHandler.INSTANCE.queueAmbientSounds(sounds);
    if (doBiomeSounds()) {
        final BiomeInfo playerBiome = EnvironState.getPlayerBiome();
        final SoundEffect sound = playerBiome.getSpotSound(this.RANDOM);
        if (sound != null)
            SoundEffectHandler.INSTANCE.playSoundAtPlayer(player, sound);
    }
    final SoundEffect sound = ClientRegistry.BIOME.PLAYER_INFO.getSpotSound(this.RANDOM);
    if (sound != null)
        SoundEffectHandler.INSTANCE.playSoundAtPlayer(player, sound);
}
Also used : SoundEffect(org.blockartistry.DynSurround.client.sound.SoundEffect) TObjectFloatHashMap(gnu.trove.map.hash.TObjectFloatHashMap) BiomeInfo(org.blockartistry.DynSurround.registry.BiomeInfo) ObjectArray(org.blockartistry.lib.collections.ObjectArray)

Aggregations

TObjectFloatHashMap (gnu.trove.map.hash.TObjectFloatHashMap)1 SoundEffect (org.blockartistry.DynSurround.client.sound.SoundEffect)1 BiomeInfo (org.blockartistry.DynSurround.registry.BiomeInfo)1 ObjectArray (org.blockartistry.lib.collections.ObjectArray)1