Class PlaySoundAtEntityEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.entity.EntityEvent
net.minecraftforge.event.entity.PlaySoundAtEntityEvent

public class PlaySoundAtEntityEvent extends EntityEvent
PlaySoundAtEntityEvent is fired a sound is to be played at an Entity
This event is fired whenever a sound is set to be played at an Entity such as in LocalPlayer.playSound(SoundEvent, float, float) and Level.playSound(Player, double, double, double, SoundEvent, SoundSource, float, float).

name contains the name of the sound to be played at the Entity.
volume contains the volume at which the sound is to be played originally.
pitch contains the pitch at which the sound is to be played originally.
newVolume contains the volume at which the sound is actually played.
newPitch contains the pitch at which the sound is actually played.
Changing the name field will cause the sound of this name to be played instead of the originally intended sound.

This event is Cancelable.
If this event is canceled, the sound is not played.

This event does not have a result. Event.HasResult

This event is fired on the MinecraftForge.EVENT_BUS.
  • Field Details

    • name

      private SoundEvent name
    • category

      private SoundSource category
    • volume

      private final float volume
    • pitch

      private final float pitch
    • newVolume

      private float newVolume
    • newPitch

      private float newPitch
  • Constructor Details

    • PlaySoundAtEntityEvent

      public PlaySoundAtEntityEvent(Entity entity, SoundEvent name, SoundSource category, float volume, float pitch)
  • Method Details

    • getSound

      public SoundEvent getSound()
    • getCategory

      public SoundSource getCategory()
    • getDefaultVolume

      public float getDefaultVolume()
    • getDefaultPitch

      public float getDefaultPitch()
    • getVolume

      public float getVolume()
    • getPitch

      public float getPitch()
    • setSound

      public void setSound(SoundEvent value)
    • setCategory

      public void setCategory(SoundSource category)
    • setVolume

      public void setVolume(float value)
    • setPitch

      public void setPitch(float value)