Skip to content

Play Sound

Plays a sound event at a position.

Type ID: kaya:play_sound

Format

Field Type Default Description
sound Sound Event The sound event to play.
category Sound Category "master" The category of the sound.
targets Array of Entity Providers optional If specified, only these entities will be able to hear the played sound.
position Vec3 Provider The position where the sound will be played.
volume Float Provider 1.0 The volume of the sound. The value will have a minimum bound of 0.0.
pitch Float Provider 1.0 The pitch of the sound. The value will be clamped within the range of 0.0 to 2.0.
min_volume Float Provider 0.0 The minimum volume of the sound. The value will be clamped within the range of 0.0 to 1.0.

Example

{
    "type": "kaya:play_sound",
    "sound": "minecraft:entity.bat.takeoff",
    "category": "neutral",
    "position": {
        "type": "kaya:entity/position",
        "entity": "this"
    },
    "volume": 0.5,
    "pitch": {
        "type": "kaya:random/uniform",
        "min": 0.0,
        "max": 1.0
    }
}

This example will play the minecraft:entity.bat.takeoff sound event at the position of the entity provided by the kaya:this_entity context parameter with a volume of 0.5 and a random pitch (with the range of 0.0 to 1.0.)

History

Minecraft Mod Changelog
1.21.5 0.1.0 Added the type.