import type { JsonSymbolSoundType } from 'sandstone/arguments/generated/_json/dispatcher.ts' import type { JsonRegistry } from 'sandstone/arguments/generated/_json/registry.ts' import type { JsonRootNBT } from 'sandstone/arguments/nbt.ts' import type { NBTFloat, NBTInt, NonEmptyString, SoundEventClass } from 'sandstone' export type JsonSound = NonNullable<({ [S in Extract, string>]?: { /** * Changes how `name` is interpreted. Defaults to `file`. * * Value: * * - File(`file`): A file. * - SoundEvent(`event`): An already defined event. */ type?: S, name: (S extends undefined ? JsonSymbolSoundType<'%none'> : (S extends keyof JsonSymbolSoundType ? JsonSymbolSoundType[S] : JsonRootNBT)), /** * Defaults to 1.0. * * Value: * Range: 0<.. * Minimum is exclusive; must be higher than 0 */ volume?: (NBTFloat<{ leftExclusive: true, min: 1, }> | number), /** * Default is 1.0. * * Value: * Range: 0<.. * Minimum is exclusive; must be higher than 0 */ pitch?: (NBTFloat<{ leftExclusive: true, min: 1, }> | number), /** * Chance that this sound is selected to play. Defaults to 1. * * Value: * Range: 1.. */ weight?: (NBTInt<{ min: 1, }> | number), /** * Whether the sound should be loaded when loading the pack instead of when the sound is played. Used by the underwater ambience. Defaults to false. */ preload?: boolean, /** * If true it will be streamed from its file. Sounds longer than a few seconds should enable this to avoid lag. Defaults to false. * When false many instances of the sound can be ran at the same time. When true only allows 4 instances (of that type) can be played. */ stream?: boolean, /** * Modify sound reduction rate based on distance. Defaults to 16. */ attenuation_distance?: (NBTInt | number), } }[Extract])> export type JsonSoundEventRegistration = { /** * The sound files this sound event uses. One sound is randomly selected to play when the event is triggered. Defaults to assumed path. */ sounds?: Array<((JsonRegistry['minecraft:sound'] | SoundEventClass) | JsonSound)>, /** * If true the sounds listed should replace the ones listed in the minecraft sounds.json for this sound event. * False if the sounds listed should be added. If undefined. Defaults to false. */ replace?: boolean, /** * Translated as the subtitle when Show Subtitles is enabled. Section sign formatting codes are supported. */ subtitle?: JsonRegistry['minecraft:translation_key'], } export type JsonSounds = ({ [Key in NonEmptyString]?: JsonSoundEventRegistration }) export type JsonSoundType = ('file' | 'event')