Package net.neoforged.neoforge.event
Class PlayLevelSoundEvent.AtEntity
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.PlayLevelSoundEvent
net.neoforged.neoforge.event.PlayLevelSoundEvent.AtEntity
- All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
- Enclosing class:
PlayLevelSoundEvent
PlayLevelSoundEvent.AtEntity is fired when a sound is played on the
Level
at an Entity
's position.
This event is fired from Level.playSound(net.minecraft.world.entity.Entity, net.minecraft.core.BlockPos, net.minecraft.sounds.SoundEvent, net.minecraft.sounds.SoundSource, float, float)
, Level.playSeededSound(net.minecraft.world.entity.player.Player, double, double, double, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent>, net.minecraft.sounds.SoundSource, float, float, long)
, and LocalPlayer.playSound(net.minecraft.sounds.SoundEvent, float, float)
.
This event is cancelable
.
If this event is canceled, the sound is not played.
This event does not have a result.
This event is fired on the NeoForge.EVENT_BUS
.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.PlayLevelSoundEvent
PlayLevelSoundEvent.AtEntity, PlayLevelSoundEvent.AtPosition
-
Field Summary
-
Constructor Summary
ConstructorDescriptionAtEntity
(Entity entity, Holder<SoundEvent> sound, SoundSource source, float volume, float pitch) -
Method Summary
Methods inherited from class net.neoforged.neoforge.event.PlayLevelSoundEvent
getLevel, getNewPitch, getNewVolume, getOriginalPitch, getOriginalVolume, getSound, getSource, setNewPitch, setNewVolume, setSound, setSource
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Field Details
-
entity
-
-
Constructor Details
-
AtEntity
public AtEntity(Entity entity, Holder<SoundEvent> sound, SoundSource source, float volume, float pitch)
-
-
Method Details
-
getEntity
Returns the entity the sound is being played on.- Returns:
- the entity the sound is being played on
-