Package etithespirit.orimod.client.audio
Class SpiritSoundPlayer
java.lang.Object
etithespirit.orimod.client.audio.SpiritSoundPlayer
Plays sounds pertaining to Spirits.
- Author:
- Eti
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic float
CallsgetRandomPitch(float)
with an value of 0.025f, the default deviation, which returns a value in the range of 1 ± 0.0125.static float
getRandomPitch
(float deviation) Returns 1 ± (deviation/2), which is intended to be used for the pitch of a sound.static void
playDashSound
(net.minecraft.world.entity.player.Player player, boolean willImmediatelyImpactWall) Plays a sound associated with the dash ability.static void
playDeathSound
(net.minecraft.world.entity.player.Player player, net.minecraft.world.damagesource.DamageSource source) Plays the sound associated with being killed.static void
playHurtSound
(net.minecraft.world.entity.player.Player player, net.minecraft.world.damagesource.DamageSource source) Plays the sound associated with being hurt.static void
playJumpSound
(net.minecraft.world.entity.player.Player player, int jumps) Plays the sound associated with the given jump count.static void
playSoundAtPlayer
(net.minecraft.world.entity.player.Player player, net.minecraft.sounds.SoundEvent sound, net.minecraft.sounds.SoundSource category, float volume) Plays a sound in the given player's world at the player's location with appropriate client/server handling.static void
playSoundAtPlayer
(net.minecraft.world.entity.player.Player player, net.minecraft.sounds.SoundEvent sound, net.minecraft.sounds.SoundSource category, float volume, float pitch) Plays a sound in the given player's world at the player's location with appropriate client/server handling.static void
playWallJumpSound
(net.minecraft.world.entity.player.Player player, net.minecraft.core.BlockPos block) Plays the sound associated with jumping against the given block.
-
Constructor Details
-
SpiritSoundPlayer
public SpiritSoundPlayer()
-
-
Method Details
-
getRandomPitch
public static float getRandomPitch()CallsgetRandomPitch(float)
with an value of 0.025f, the default deviation, which returns a value in the range of 1 ± 0.0125. -
getRandomPitch
public static float getRandomPitch(float deviation) Returns 1 ± (deviation/2), which is intended to be used for the pitch of a sound.- Parameters:
deviation
- The range from which a sound may have a different pitch. This is centered around 100% pitch, so the resulting pitch will range from1 - (deviation/2)
to1 + (deviation/2)
.
-
playSoundAtPlayer
public static void playSoundAtPlayer(@Nonnull net.minecraft.world.entity.player.Player player, @Nonnull net.minecraft.sounds.SoundEvent sound, @Nonnull net.minecraft.sounds.SoundSource category, float volume, float pitch) Plays a sound in the given player's world at the player's location with appropriate client/server handling.- Parameters:
player
- The player to play the sound forsound
- The sound to playcategory
- The category of the soundvolume
- The volume of the soundpitch
- The pitch of the sound- Throws:
ArgumentNullException
- if any arguments denoted as @Nonnull are null.
-
playSoundAtPlayer
public static void playSoundAtPlayer(@Nonnull net.minecraft.world.entity.player.Player player, @Nonnull net.minecraft.sounds.SoundEvent sound, @Nonnull net.minecraft.sounds.SoundSource category, float volume) Plays a sound in the given player's world at the player's location with appropriate client/server handling. Provides a random pitch of 1 +- 0.025- Parameters:
player
- The player to play the sound forsound
- The sound to playcategory
- The category of the soundvolume
- The volume of the sound- Throws:
ArgumentNullException
- if any arguments denoted as @Nonnull are null.
-
playDashSound
public static void playDashSound(@Nonnull net.minecraft.world.entity.player.Player player, boolean willImmediatelyImpactWall) Plays a sound associated with the dash ability.- Parameters:
player
- The player to play for. Whether or not they are a spirit is validated in this method.willImmediatelyImpactWall
- Whether or not they will immediately impact a wall if they dash.- Throws:
ArgumentNullException
- if any arguments denoted as @Nonnull are null.
-
playJumpSound
public static void playJumpSound(@Nonnull net.minecraft.world.entity.player.Player player, int jumps) Plays the sound associated with the given jump count.- Parameters:
player
- The player to play for. Whether or not they are a spirit is validated in this method.jumps
- The amount of jumps they have performed when this sound is called, which should either be 1, 2, or 3.- Throws:
ArgumentNullException
- if any arguments denoted as @Nonnull are null.
-
playWallJumpSound
public static void playWallJumpSound(@Nonnull net.minecraft.world.entity.player.Player player, @Nonnull net.minecraft.core.BlockPos block) Plays the sound associated with jumping against the given block.- Parameters:
player
- The player to play for. Whether or not they are a spirit is validated in this method.- Throws:
ArgumentNullException
- if any arguments denoted as @Nonnull are null.
-
playHurtSound
public static void playHurtSound(@Nonnull net.minecraft.world.entity.player.Player player, @Nonnull net.minecraft.world.damagesource.DamageSource source) Plays the sound associated with being hurt.- Parameters:
player
- The player to play for. Whether or not they are a spirit is validated in this method.source
- The cause of the damage.- Throws:
ArgumentNullException
- if any arguments denoted as @Nonnull are null.
-
playDeathSound
public static void playDeathSound(@Nonnull net.minecraft.world.entity.player.Player player, @Nonnull net.minecraft.world.damagesource.DamageSource source) Plays the sound associated with being killed.- Parameters:
player
- The player to play for. Whether or not they are a spirit is validated in this method.source
- The cause of the damage.- Throws:
ArgumentNullException
- if any arguments denoted as @Nonnull are null.
-