Class PlaySoundEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.client.event.sound.SoundEvent
net.neoforged.neoforge.client.event.sound.PlaySoundEvent
Fired when a sound is about to be played by the sound engine. This fires before the sound is played and before any
 checks on the sound (such as a zeroed volume, an empty 
Sound, and
 others). This can be used to change or prevent (by passing null) a sound from being played through
 setSound(SoundInstance)).
 This event is not 
, and does not 
invalid reference
cancellable
.invalid reference
have a result
This event is fired on the main Forge event bus, only on the logical client.
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class net.neoforged.neoforge.client.event.sound.SoundEventSoundEvent.SoundSourceEvent
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate final Stringprivate final SoundInstanceprivate @Nullable SoundInstance
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiongetName()Returns the name of the original sound.Returns the original sound that was to be played.@Nullable SoundInstancegetSound()Returns the sound to be played, ornullif no sound will be played.voidsetSound(@Nullable SoundInstance newSound) Sets the sound to be played, which may benullto prevent any sound from being played.Methods inherited from class net.neoforged.neoforge.client.event.sound.SoundEventgetEngine
- 
Field Details- 
name
- 
originalSound
- 
sound
 
- 
- 
Constructor Details- 
PlaySoundEvent
 
- 
- 
Method Details- 
getNameReturns the name of the original sound. This is equivalent to the path of the location of the original sound.- Returns:
- the name of the original sound
 
- 
getOriginalSoundReturns the original sound that was to be played.- Returns:
- the original sound that was to be played
 
- 
getSoundReturns the sound to be played, ornullif no sound will be played.- Returns:
- the sound to be played, or nullif no sound will be played
 
- 
setSoundSets the sound to be played, which may benullto prevent any sound from being played.- Parameters:
- newSound- the new sound to be played, or- nullfor no sound
 
 
-