Bullet Sounds - MUKSC/TaCZTweaks GitHub Wiki

Using bullet sounds, you can add various sounds to bullets.
In order to define a bullet sound, you need to create a data pack for it.
If you don't know how to make a data pack, please refer to other resources such as Minecraft Wiki.

Each bullet sound must be defined in a directory named bullet_sounds.
For example: data/example/bullet_sounds/example_sounds.json

There are 3 types of bullet sounds: block, entity, whizz and constant, which are specified by the type field.

Block Sounds

In block sounds, you can make bullets play sounds on different situations.

{
    "type": "block",
    // Target, see the "Common Types" page
    // Accepts either a single object or a list of objects, and matches if any one of them is valid
    // Can be omitted and it will be used as a fallback, which will be used if no other sounds are applicable
    "target": {
        "type": "ammo",
        "values": [
            "tacz:40mm"
        ]
    },
    // Specifies the target blocks for this sounds, and matches if any one of them is valid
    // Accepts block ids, block tags, or any of the "Block Target" types (see the "Common Types" page)
    // Can be omitted and it will be used as a fallback, which will be used if no other sounds are applicable
    "blocks": [
        "minecraft:stone",
        "#forge:glass",
        {
            "type": "regex",
            "regex": "tacz:.+"
        }
    ],
    // All of the following 3 have the same data structure
    // Specifies the sound to play on the corresponding situation
    // Accepts either a single object or a list of objects
    // Can be omitted and there will be no sound for it
    // Note: If the bullet pierces, the "pierce" sound will play instead of the "hit" sound
    "hit": ...,
    "pierce": ...,
    "break": {
        "sound": "minecraft:block.amethyst_block.hit",
        // Can be omitted and defaults to 1.0
        "volume": 1.0,
        // Can be omitted and defaults to 1.0
        "pitch": 1.0
    },
    // Specifies the priority of this sound
    // If multiple sounds share the same priority, they are prioritized in this order:
    //   1. Those with both `target` and `entities` specified
    //   2. Those with only `target` specified
    //   3. Those with only `entities` specified
    //   4. Those with neither specified
    // Beyond these criteria, the final ordering is undefined and depends on the game's load order
    // Can be omitted and defaults to 0
    "priority": 0
}

Entity Sounds

In entity sounds, you can make bullets play sounds on different situations.

{
    "type": "entity",
    // Target, see the "Common Types" page
    // Accepts either a single object or a list of objects, and matches if any one of them is valid
    // Can be omitted and it will be used as a fallback, which will be used if no other sounds are applicable
    "target": {
        "type": "ammo",
        "values": [
            "tacz:40mm"
        ]
    },
    // Specifies the target entities for this sounds, and matches if any one of them is valid
    // Accepts entity ids, entity tags, or any of the "Entity Target" types (see the "Common Types" page)
    // Can be omitted and it will be used as a fallback, which will be used if no other sounds are applicable
    "entities": [
        "minecraft:creeper",
        "#minecraft:skeletons",
        {
            "type": "health",
            "unit": "raw",
            "range": {
                "max": 5.0
            }
        }
    ],
    // All of the following 3 have the same data structure
    // Specifies the sound to play on the corresponding situation
    // Accepts either a single object or a list of objects
    // Can be omitted and there will be no sound for it
    // Note: If the bullet pierces, the "pierce" sound will play instead of the "hit" sound
    "hit": ...,
    "pierce": ...,
    "kill": {
        "sound": "minecraft:block.amethyst_block.hit",
        // Can be omitted and defaults to 1.0
        "volume": 1.0,
        // Can be omitted and defaults to 1.0
        "pitch": 1.0
    },
    // Specifies the priority of this sound
    // If multiple sounds share the same priority, they are prioritized in this order:
    //   1. Those with both `target` and `entities` specified
    //   2. Those with only `target` specified
    //   3. Those with only `entities` specified
    //   4. Those with neither specified
    // Beyond these criteria, the final ordering is undefined and depends on the game's load order
    // Can be omitted and defaults to 0
    "priority": 0
}

Whizz Sounds

In whizz sounds, you can make bullets play sounds when they pass by a player.

{
    "type": "whizz",
    // Target, see the "Common Types" page
    // Accepts either a single object or a list of objects, and matches if any one of them is valid
    // Can be omitted and it will be used as a fallback, which will be used if no other sounds are applicable
    "target": {
        "type": "ammo",
        "values": [
            "tacz:40mm"
        ]
    },
    // Specifies the sounds to play based on the distance
    "sounds": [
        {
            // This sound will be played if the distance is smaller than this value
            "threshold": 2.0,
            "sound": {
                "sound": "minecraft:block.amethyst_block.hit",
                // Can be omitted and defaults to 1.0
                "volume": 1.0,
                // Can be omitted and defaults to 1.0
                "pitch": 1.0
            }
        }
    ],
    // Specifies the priority of this sound
    // If multiple sounds share the same priority, the ordering is undefined and depends on the game's load order
    // Can be omitted and defaults to 0
    "priority": 0
}

Constant Sounds

In constant sounds, you can make bullets play sounds at a specified interval.

{
    "type": "constant",
    // Target, see the "Common Types" page
    // Accepts either a single object or a list of objects, and matches if any one of them is valid
    // Can be omitted and it will be used as a fallback, which will be used if no other sounds are applicable
    "target": {
        "type": "ammo",
        "values": [
            "tacz:40mm"
        ]
    },
    // Specifies the tick interval to play sounds
    // E.g.1 means every tick
    "interval": 1,
    // Specifies the sound to play
    "sounds": [
        {
            "sound": "minecraft:item.firecharge.use",
            // Can be omitted and defaults to 1.0
            "volume": 1.0,
            // Can be omitted and defaults to 1.0
            "pitch": 1.0
        }
    ],
    // Specifies the priority of this sound
    // If multiple sounds share the same priority, the ordering is undefined and depends on the game's load order
    // Can be omitted and defaults to 0
    "priority": 0
}
⚠️ **GitHub.com Fallback** ⚠️