Example usage for net.minecraftforge.client.event.sound PlaySoundEvent getName

List of usage examples for net.minecraftforge.client.event.sound PlaySoundEvent getName

Introduction

In this page you can find the example usage for net.minecraftforge.client.event.sound PlaySoundEvent getName.

Prototype

public String getName() 

Source Link

Usage

From source file:org.blockartistry.DynSurround.client.handlers.SoundEffectHandler.java

License:MIT License

@SubscribeEvent
public void soundPlay(@Nonnull final PlaySoundEvent e) {
    if (e.getName().equals("entity.lightning.thunder")) {
        final ISound sound = e.getSound();
        final BlockPos pos = new BlockPos(sound.getXPosF(), sound.getYPosF(), sound.getZPosF());
        final ISound newSound = Sounds.THUNDER.createSound(pos).setVolume(ModOptions.thunderVolume);
        e.setResultSound(newSound);//from w  w w. j  a  v a2 s.  com
    }
}

From source file:org.blockartistry.mod.DynSurround.client.PlayerSoundEffectHandler.java

License:MIT License

@SubscribeEvent
public void soundEvent(final PlaySoundEvent event) {
    if (event.getSound() == null)
        return;/*from  w ww .  j a  v  a2s . co m*/

    if ((ModOptions.alwaysOverrideSound || !StormProperties.doVanilla()) && replaceRainSound(event.getName())) {
        final ISound sound = event.getSound();
        event.setResultSound(new PositionedSoundRecord(StormProperties.getCurrentStormSound(),
                SoundCategory.WEATHER, StormProperties.getCurrentVolume(), sound.getPitch(), sound.getXPosF(),
                sound.getYPosF(), sound.getZPosF()));
        return;
    }
}