Package net.minecraftforge.event.entity
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 inClientPlayerEntity.playSound(SoundEvent, float, float)
andWorld.playSound(PlayerEntity, double, double, double, SoundEvent, SoundCategory, 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 thename
field will cause the sound of this name to be played instead of the originally intended sound.
This event isCancelable
.
If this event is canceled, the sound is not played.
This event does not have a result.Event.HasResult
This event is fired on theMinecraftForge.EVENT_BUS
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.minecraftforge.event.entity.EntityEvent
EntityEvent.CanUpdate, EntityEvent.EnteringChunk, EntityEvent.EntityConstructing, EntityEvent.Size
-
-
Field Summary
Fields Modifier and Type Field Description private SoundCategory
category
private SoundEvent
name
private float
newPitch
private float
newVolume
private float
pitch
private float
volume
-
Constructor Summary
Constructors Constructor Description PlaySoundAtEntityEvent(Entity entity, SoundEvent name, SoundCategory category, float volume, float pitch)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SoundCategory
getCategory()
float
getDefaultPitch()
float
getDefaultVolume()
float
getPitch()
SoundEvent
getSound()
float
getVolume()
void
setCategory(SoundCategory category)
void
setPitch(float value)
void
setSound(SoundEvent value)
void
setVolume(float value)
-
Methods inherited from class net.minecraftforge.event.entity.EntityEvent
getEntity
-
-
-
-
Field Detail
-
name
private SoundEvent name
-
category
private SoundCategory category
-
volume
private final float volume
-
pitch
private final float pitch
-
newVolume
private float newVolume
-
newPitch
private float newPitch
-
-
Constructor Detail
-
PlaySoundAtEntityEvent
public PlaySoundAtEntityEvent(Entity entity, SoundEvent name, SoundCategory category, float volume, float pitch)
-
-
Method Detail
-
getSound
public SoundEvent getSound()
-
getCategory
public SoundCategory 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(SoundCategory category)
-
setVolume
public void setVolume(float value)
-
setPitch
public void setPitch(float value)
-
-