Enum Class NotificationSound

java.lang.Object
java.lang.Enum<NotificationSound>
me.hackware.api.util.NotificationSound
All Implemented Interfaces:
Serializable, Comparable<NotificationSound>, Constable

public enum NotificationSound extends Enum<NotificationSound>
Shared sound presets for notification modules.

Each preset wraps a SoundEvent supplier, including custom sounds bundled in our assets folder.

  • Enum Constant Details

  • Method Details

    • values

      public static NotificationSound[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static NotificationSound valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • get

      public net.minecraft.sounds.SoundEvent get()
      Returns the preset SoundEvent, or null for NONE and
      invalid reference
      #Custom
      .
    • play

      public void play(net.minecraft.world.entity.player.Player player)
      Play the preset sound at default volume/pitch.
    • play

      public void play(net.minecraft.world.entity.player.Player player, float volume, float pitch)
      Play the preset sound with the given volume and pitch.

      Everything — vanilla and custom alike — goes through the SoundManager. Our own oggs carry an HWID tracker in release builds that the vanilla decoder rejects; that is stripped at load time by SoundBufferLibraryMixin, not by playing them ourselves. Hand-rolled OpenAL playback shares its object ids with the sound engine, and a stray free there corrupts the engine's cached buffers.

    • registerSounds

      public static void registerSounds()
      Registers all custom SoundEvents in the sound registry. Must be called during mod initialization (e.g. onInitializeClient).