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
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
Changing the
This event is
If this event is canceled, the sound is not played.
This event does not have a result.
This event is fired on the
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
.-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.event.entity.EntityEvent
EntityEvent.CanUpdate, EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
Field Summary
Modifier and TypeFieldDescriptionprivate SoundSource
private SoundEvent
private float
private float
private final float
private final float
-
Constructor Summary
ConstructorDescriptionPlaySoundAtEntityEvent
(Entity entity, SoundEvent name, SoundSource category, float volume, float pitch) -
Method Summary
Modifier and TypeMethodDescriptionfloat
float
float
getPitch()
getSound()
float
void
setCategory
(SoundSource category) void
setPitch
(float value) void
setSound
(SoundEvent value) void
setVolume
(float value) Methods inherited from class net.minecraftforge.event.entity.EntityEvent
getEntity
Methods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getParentListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult, setup
-
Field Details
-
name
-
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
-
getCategory
-
getDefaultVolume
public float getDefaultVolume() -
getDefaultPitch
public float getDefaultPitch() -
getVolume
public float getVolume() -
getPitch
public float getPitch() -
setSound
-
setCategory
-
setVolume
public void setVolume(float value) -
setPitch
public void setPitch(float value)
-