类 PlayLevelSoundEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.PlayLevelSoundEvent
public class PlayLevelSoundEvent
extends net.minecraftforge.eventbus.api.Event
PlayLevelSoundEvent is fired when a sound is played on a
Level
.
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)
.
getLevel()
contains the level the sound is being played in.
getSound()
contains the sound event to be played.
getOriginalVolume()
contains the original volume for the sound to be played at.
getOriginalPitch()
contains the original pitch for the sound to be played at.
getNewVolume()
contains the volume the sound will be played at.
getNewPitch()
contains the pitch the sound will be played at.
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 MinecraftForge.EVENT_BUS
.
-
嵌套类概要
嵌套类修饰符和类型类说明static class
static class
PlayLevelSoundEvent.AtPosition is fired when a sound is played on theLevel
at a specific position.从类继承的嵌套类/接口 net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
字段概要
字段修饰符和类型字段说明private final Level
private float
private float
private final float
private final float
private Holder
<SoundEvent> private SoundSource
-
构造器概要
构造器构造器说明PlayLevelSoundEvent
(@NotNull Level level, @NotNull Holder<SoundEvent> sound, @NotNull SoundSource source, float volume, float pitch) -
方法概要
修饰符和类型方法说明@NotNull Level
getLevel()
返回 the level the sound is being played in。float
返回 the pitch the sound will be played at。float
返回 the volume the sound will be played at。float
返回 the original pitch for the sound to be played at。float
返回 the original volume for the sound to be played at。@Nullable Holder
<SoundEvent> getSound()
返回 the sound event to be played。@NotNull SoundSource
返回 the sound source。void
setNewPitch
(float newPitch) Sets the pitch the sound will be played at.void
setNewVolume
(float newVolume) Sets the volume the sound will be played at.void
setSound
(@Nullable Holder<SoundEvent> sound) Sets the sound event to be played.void
setSource
(@NotNull SoundSource source) Sets the sound source.从类继承的方法 net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
字段详细资料
-
level
-
originalVolume
private final float originalVolume -
originalPitch
private final float originalPitch -
sound
-
source
-
newVolume
private float newVolume -
newPitch
private float newPitch
-
-
构造器详细资料
-
PlayLevelSoundEvent
public PlayLevelSoundEvent(@NotNull @NotNull Level level, @NotNull @NotNull Holder<SoundEvent> sound, @NotNull @NotNull SoundSource source, float volume, float pitch)
-
-
方法详细资料
-
getLevel
返回 the level the sound is being played in。- 返回:
- the level the sound is being played in
-
getSound
返回 the sound event to be played。- 返回:
- the sound event to be played
-
setSound
Sets the sound event to be played. -
getSource
返回 the sound source。- 返回:
- the sound source
-
setSource
Sets the sound source. -
getOriginalVolume
public float getOriginalVolume()返回 the original volume for the sound to be played at。- 返回:
- the original volume for the sound to be played at
-
getOriginalPitch
public float getOriginalPitch()返回 the original pitch for the sound to be played at。- 返回:
- the original pitch for the sound to be played at
-
getNewVolume
public float getNewVolume()返回 the volume the sound will be played at。- 返回:
- the volume the sound will be played at
-
setNewVolume
public void setNewVolume(float newVolume) Sets the volume the sound will be played at. -
getNewPitch
public float getNewPitch()返回 the pitch the sound will be played at。- 返回:
- the pitch the sound will be played at
-
setNewPitch
public void setNewPitch(float newPitch) Sets the pitch the sound will be played at.
-