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

public static class PlayLevelSoundEvent.AtEntity extends 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.Entity, double, double, double, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent>, net.minecraft.sounds.SoundSource, float, float, long), and
invalid reference
LocalPlayer#playSound
.

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.

  • Field Details

    • entity

      private final net.minecraft.world.entity.Entity entity
  • Constructor Details

    • AtEntity

      public AtEntity(net.minecraft.world.entity.Entity entity, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> sound, net.minecraft.sounds.SoundSource source, float volume, float pitch)
  • Method Details

    • getEntity

      public net.minecraft.world.entity.Entity getEntity()
      Returns the entity the sound is being played on.
      Returns:
      the entity the sound is being played on