Class Sounds

java.lang.Object
com.github.darksoulq.abyssallib.server.resource.asset.Sounds
All Implemented Interfaces:
Asset

public class Sounds extends Object implements Asset
Acts as the centralized registry for custom sound events within a specific namespace.

This class implements the Asset interface and is responsible for managing multiple SoundEvent instances, eventually compiling them into a single sounds.json file during resource pack generation.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Sounds(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull String namespace)
    Constructs a new Sound registry for a designated namespace.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    emit(@NotNull Map<String,byte[]> files)
    Compiles all registered sound events into the standard sounds.json structure and exports the physical .ogg files into the final resource pack byte map.
    @NotNull SoundEvent
    event(@NotNull String eventName)
    Creates or retrieves a SoundEvent linked to the specified event name.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Sounds

      public Sounds(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull String namespace)
      Constructs a new Sound registry for a designated namespace.
      Parameters:
      plugin - The plugin providing the foundational resource context.
      namespace - The namespace prefix used for all JSON definitions and file structures.
  • Method Details

    • event

      @NotNull public @NotNull SoundEvent event(@NotNull @NotNull String eventName)
      Creates or retrieves a SoundEvent linked to the specified event name.

      Note: The event name represents the trigger identifier (e.g., "entity.custom_zombie.ambient"), not the actual name of the physical .ogg file.

      Parameters:
      eventName - The registry name for this sound event.
      Returns:
      The resulting SoundEvent instance for method chaining and variant registration.
    • emit

      public void emit(@NotNull @NotNull Map<String,byte[]> files)
      Compiles all registered sound events into the standard sounds.json structure and exports the physical .ogg files into the final resource pack byte map.
      Specified by:
      emit in interface Asset
      Parameters:
      files - The global map of resource pack files where paths act as keys and byte arrays as data.