Class SoundUtil

java.lang.Object
com.hypixel.hytale.server.core.universe.world.SoundUtil

public class SoundUtil extends Object
A utility class that contains a variety of useful sound methods.
  • Constructor Details

    • SoundUtil

      public SoundUtil()
  • Method Details

    • playItemSoundEvent

      public static void playItemSoundEvent(@Nonnull Ref<EntityStore> ref, @Nonnull Store<EntityStore> store, @Nonnull Item item, @Nonnull ItemSoundEvent itemSoundEvent)
      Called to play a item sound event from the given item to the given entity.
      Parameters:
      ref - The entity reference of the target entity.
      store - The Store<EntityStore> for entity storage.
      item - The item to play the sound from.
      itemSoundEvent - The item sound event to play.
    • playSoundEventEntity

      public static void playSoundEventEntity(int soundEventIndex, int networkId, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a sound event to all players from the given target entity.
      Parameters:
      soundEventIndex - The index of the sound event.
      networkId - The network ID of the target entity.
      componentAccessor - The invalid input: '<' EntityStore > for component access.
    • playSoundEventEntity

      public static void playSoundEventEntity(int soundEventIndex, int networkId, float volumeModifier, float pitchModifier, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a sound event to all players from the given target entity.
      Parameters:
      soundEventIndex - The index of the sound event.
      networkId - The network ID of the target entity.
      volumeModifier - Volume modifier (linear gain).
      pitchModifier - Pitch modifier (linear pitch).
      componentAccessor - The invalid input: '<' EntityStore > for component access.
    • playSoundEvent2dToPlayer

      public static void playSoundEvent2dToPlayer(@Nonnull PlayerRef playerRefComponent, int soundEventIndex, @Nonnull SoundCategory soundCategory)
      Called to play a two-dimensional sound event to a specific player.
      Parameters:
      playerRefComponent - The PlayerRef component of the player.
      soundEventIndex - The index of the sound event.
      soundCategory - The category of the sound event.
    • playSoundEvent2dToPlayer

      public static void playSoundEvent2dToPlayer(@Nonnull PlayerRef playerRefComponent, int soundEventIndex, @Nonnull SoundCategory soundCategory, float volumeModifier, float pitchModifier)
      Called to play a two-dimensional sound event to a specific player.
      Parameters:
      playerRefComponent - The PlayerRef component of the player.
      soundEventIndex - The index of the sound event.
      soundCategory - The category of the sound event.
      volumeModifier - Volume modifier (linear gain).
      pitchModifier - Pitch modifier (linear pitch).
    • playSoundEvent2dToPlayer

      public static void playSoundEvent2dToPlayer(@Nonnull PlayerRef playerRefComponent, @Nullable String soundEventId, @Nonnull SoundCategory soundCategory)
      Called to play a two-dimensional sound event to a specific player, by asset id.
      Parameters:
      playerRefComponent - The PlayerRef component of the player.
      soundEventId - The asset id of the sound event. null or an unknown id plays nothing.
      soundCategory - The category of the sound event.
    • playSoundEvent2dToWorld

      public static void playSoundEvent2dToWorld(@Nonnull World world, @Nullable String soundEventId, @Nonnull SoundCategory soundCategory)
      Called to play a two-dimensional sound event to every player in a world, by asset id.
      Parameters:
      world - The World whose players hear the sound event.
      soundEventId - The asset id of the sound event. null or an unknown id plays nothing.
      soundCategory - The category of the sound event.
    • playLocalPlayerSoundEvent

      public static void playLocalPlayerSoundEvent(@Nonnull PlayerRef playerRefComponent, int localSoundEventIndex, int worldSoundEventIndex, @Nonnull SoundCategory soundCategory)
      Called to play a sound event to a specific player, sending both local and world sound event indices so the client can choose based on camera mode (2D in first person, 3D in third person).
      Parameters:
      playerRefComponent - The PlayerRef component of the player.
      localSoundEventIndex - The index of the local (2D) sound event.
      worldSoundEventIndex - The index of the world (3D) sound event.
      soundCategory - The category of the sound event.
    • playLocalPlayerSoundEvent

      public static void playLocalPlayerSoundEvent(@Nonnull PlayerRef playerRefComponent, int localSoundEventIndex, int worldSoundEventIndex, @Nonnull SoundCategory soundCategory, float volumeModifier, float pitchModifier)
      Called to play a sound event to a specific player, sending both local and world sound event indices so the client can choose based on camera mode (2D in first person, 3D in third person).
      Parameters:
      playerRefComponent - The PlayerRef component of the player.
      localSoundEventIndex - The index of the local (2D) sound event.
      worldSoundEventIndex - The index of the world (3D) sound event.
      soundCategory - The category of the sound event.
      volumeModifier - Volume modifier (linear gain).
      pitchModifier - Pitch modifier (linear pitch).
    • playSoundEvent2d

      public static void playSoundEvent2d(int soundEventIndex, @Nonnull SoundCategory soundCategory, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to broadcast a two-dimensional sound event to all players.
      Parameters:
      soundEventIndex - The index of the sound event.
      soundCategory - The category of the sound event.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
    • playSoundEvent2d

      public static void playSoundEvent2d(int soundEventIndex, @Nonnull SoundCategory soundCategory, float volumeModifier, float pitchModifier, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to broadcast a two-dimensional sound event to all players.
      Parameters:
      soundEventIndex - The index of the sound event.
      soundCategory - The category of the sound event.
      volumeModifier - Volume modifier (linear gain).
      pitchModifier - Pitch modifier (linear pitch).
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
    • playSoundEvent2d

      public static void playSoundEvent2d(@Nonnull Ref<EntityStore> ref, int soundEventIndex, @Nonnull SoundCategory soundCategory, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a two-dimensional sound event to a specific player.
      Parameters:
      ref - The entity reference of the target player entity.
      soundEventIndex - The index of the sound event.
      soundCategory - The category of the sound event.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
    • playSoundEvent2d

      public static void playSoundEvent2d(@Nonnull Ref<EntityStore> ref, int soundEventIndex, @Nonnull SoundCategory soundCategory, float volumeModifier, float pitchModifier, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a two-dimensional sound event to a specific player.
      Parameters:
      ref - The entity reference of the target player entity.
      soundEventIndex - The index of the sound event.
      soundCategory - The category of the sound event.
      volumeModifier - Volume modifier (linear gain).
      pitchModifier - Pitch modifier (linear pitch).
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
    • playSoundEvent3d

      public static void playSoundEvent3d(int soundEventIndex, @Nonnull SoundCategory soundCategory, double x, double y, double z, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a three-dimensional sound event to this player.
      Parameters:
      soundEventIndex - The index of the sound event.
      soundCategory - The category of the sound event.
      x - The X position of the sound.
      y - The Y position of the sound.
      z - The Z position of the sound.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
    • playSoundEvent3d

      public static void playSoundEvent3d(int soundEventIndex, @Nonnull SoundCategory soundCategory, double x, double y, double z, float volumeModifier, float pitchModifier, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a three-dimensional sound event to this player.
      Parameters:
      soundEventIndex - The index of the sound event.
      soundCategory - The category of the sound event.
      x - The X position of the sound.
      y - The Y position of the sound.
      z - The Z position of the sound.
      volumeModifier - Volume modifier (linear gain).
      pitchModifier - Pitch modifier (linear pitch).
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
    • playSoundEvent3d

      public static void playSoundEvent3d(int soundEventIndex, @Nonnull SoundCategory soundCategory, @Nonnull org.joml.Vector3d position, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a three-dimensional sound event to this player.
      Parameters:
      soundEventIndex - The index of the sound event.
      soundCategory - The category of the sound event.
      position - The position of the sound.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
    • playSoundEvent3d

      public static void playSoundEvent3d(int soundEventIndex, @Nonnull SoundCategory soundCategory, double x, double y, double z, @Nonnull Predicate<Ref<EntityStore>> shouldHear, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a three-dimensional sound event to this player.
      Parameters:
      soundEventIndex - The index of the sound event.
      soundCategory - The category of the sound event.
      x - The X position of the sound.
      y - The Y position of the sound.
      z - The Z position of the sound.
      shouldHear - A predicate that determines which players can hear the sound event.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
    • playSoundEvent3d

      public static void playSoundEvent3d(int soundEventIndex, @Nonnull SoundCategory soundCategory, double x, double y, double z, float volumeModifier, float pitchModifier, @Nonnull Predicate<Ref<EntityStore>> shouldHear, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a three-dimensional sound event to this player.
      Parameters:
      soundEventIndex - The index of the sound event.
      soundCategory - The category of the sound event.
      x - The X position of the sound.
      y - The Y position of the sound.
      z - The Z position of the sound.
      volumeModifier - Volume modifier (linear gain).
      pitchModifier - Pitch modifier (linear pitch).
      shouldHear - A predicate that determines which players can hear the sound event.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
    • playSoundEvent3d

      public static void playSoundEvent3d(@Nullable Ref<EntityStore> sourceRef, int soundEventIndex, @Nonnull org.joml.Vector3d pos, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a three-dimensional sound event at the given position.
      Parameters:
      sourceRef - The entity reference of the source entity.
      soundEventIndex - The index of the sound event.
      pos - The position of the sound.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
    • playSoundEvent3d

      public static void playSoundEvent3d(@Nullable Ref<EntityStore> sourceRef, int soundEventIndex, double x, double y, double z, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a three-dimensional sound event at the given position.
      Parameters:
      sourceRef - The entity reference of the source entity.
      soundEventIndex - The index of the sound event.
      x - The X position of the sound.
      y - The Y position of the sound.
      z - The Z position of the sound.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
    • playSoundEvent3d

      public static void playSoundEvent3d(@Nullable Ref<EntityStore> sourceRef, int soundEventIndex, @Nonnull org.joml.Vector3d position, boolean ignoreSource, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a three-dimensional sound event at the given position.
      Parameters:
      sourceRef - The entity reference of the source entity.
      soundEventIndex - The index of the sound event.
      position - The position of the sound.
      ignoreSource - Whether to ignore the source entity.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
    • playSoundEvent3d

      public static void playSoundEvent3d(@Nullable Ref<EntityStore> sourceRef, int soundEventIndex, double x, double y, double z, boolean ignoreSource, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a three-dimensional sound event at the given position.
      Parameters:
      sourceRef - The entity reference of the source entity.
      soundEventIndex - The index of the sound event.
      x - The X position of the sound.
      y - The Y position of the sound.
      z - The Z position of the sound.
      ignoreSource - Whether to ignore the source entity.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
    • playSoundEvent3d

      public static void playSoundEvent3d(int soundEventIndex, double x, double y, double z, @Nonnull Predicate<Ref<EntityStore>> shouldHear, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a three-dimensional sound event at the given position.
      Parameters:
      soundEventIndex - The index of the sound event.
      x - The X position of the sound.
      y - The Y position of the sound.
      z - The Z position of the sound.
      shouldHear - A predicate to determine whether an entity should hear this sound.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
    • playSoundEvent3dToPlayer

      public static void playSoundEvent3dToPlayer(@Nullable Ref<EntityStore> playerRef, int soundEventIndex, @Nonnull SoundCategory soundCategory, double x, double y, double z, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a three-dimensional sound event to this player.
      Parameters:
      playerRef - The entity reference of the player entity.
      soundEventIndex - The index of the sound event.
      soundCategory - The category of the sound event.
      x - The X position of the sound.
      y - The Y position of the sound.
      z - The Z position of the sound.
      componentAccessor - The ComponentAccessor for component access.
    • playSoundEvent3dToPlayer

      public static void playSoundEvent3dToPlayer(@Nullable Ref<EntityStore> playerRef, int soundEventIndex, @Nonnull SoundCategory soundCategory, double x, double y, double z, float volumeModifier, float pitchModifier, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a three-dimensional sound event to this player.
      Parameters:
      playerRef - The entity reference of the player entity.
      soundEventIndex - The index of the sound event.
      soundCategory - The category of the sound event.
      x - The X position of the sound.
      y - The Y position of the sound.
      z - The Z position of the sound.
      volumeModifier - Volume modifier (linear gain).
      pitchModifier - Pitch modifier (linear pitch).
      componentAccessor - The ComponentAccessor for component access.
    • playSoundEvent3dToPlayer

      public static void playSoundEvent3dToPlayer(@Nullable Ref<EntityStore> playerRef, int soundEventIndex, @Nonnull SoundCategory soundCategory, @Nonnull org.joml.Vector3d position, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to play a three-dimensional sound event to this player.
      Parameters:
      playerRef - The entity reference of the player entity.
      soundEventIndex - The index of the sound event.
      soundCategory - The category of the sound event.
      position - The position of the sound.
      componentAccessor - The ComponentAccessor for component access.