Bullet Interactions - MUKSC/TaCZTweaks GitHub Wiki

Using bullet interactions, you can customize how bullets will interact with blocks and entities.
In order to define a bullet interaction, 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 interaction must be defined in a directory named bullet_interactions.
For example: data/example/bullet_interactions/example_interaction.json

There are 2 types of bullet interactions: block and entity, which are specified by the type field.

Block Interactions

In block interactions, you can make bullets pierce/break certain blocks.

{
    "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 interactions are applicable
    "target": {
        "type": "gun",
        "values": [
            "tacz:m320"
        ]
    },
    // Specifies the target blocks for this interaction, 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 interactions are applicable
    "blocks": [
        "minecraft:stone",
        "#forge:glass",
        {
            "type": "regex",
            "regex": "tacz:.+"
        }
    ],
    // Specifies when and how bullets destroy blocks
    // The "dynamic_damage" type is the one you will use the most
    "block_break": {
        // With the "never" block break type, bullets will never break blocks
        "type": "never",

        // With the "instant" block break type, bullets will break blocks instantly
        "type": "instant",
        // Whether the block will drop or not
        // Can be omitted and defaults to false
        "drop": false,

        // With the "count" block break type, bullets will break blocks after a certain number of hits
        "type": "count",
        "count": 3,
        // Whether the block will drop or not
        // Can be omitted and defaults to false
        "drop": false,

        // With the "fixed_damage" block break type, bullets will deal a fixed amount of damage to blocks
        // It takes the armor piercing value into account
        "type": "fixed_damage",
        "damage": 5.0,
        // Whether the damage will be accumulated or not
        // If set to false, you need to deal enough damage to one-shot blocks
        // Can be omitted and defaults to true
        "accumulate": true,
        // Whether the block will drop or not
        // Can be omitted and defaults to false
        "drop": false,

        // With the "dynamic_damage" block break type, bullets will deal a damage to blocks based on their stats
        // It takes the armor piercing value into account
        "type": "dynamic_damage",
        // Modifies the damage by this value
        // Can be omitted and defaults to 0.0
        "modifier": 0.0,
        // Multiplies the damage by this value
        // Can be omitted and defaults to 1.0,
        "multiplier": 1.0,
        // Whether the damage will be accumulated or not
        // If set to false, you need to deal enough damage to one-shot blocks
        // Can be omitted and defaults to true
        "accumulate": true,
        // Whether the block will drop or not
        // Can be omitted and defaults to false
        "drop": false
    },
    // Specifies when and how bullets bullets pierce blocks
    // The "damage" type is the one you will use the most
    "pierce": {
        // With the "never" pierce type, bullets will never pierce blocks
        "type": "never",

        // With the "default" pierce type, bullets will pierce blocks as long as other conditions are met
        "type": "default",
        // Whether it requires the block to be broken in order to pierce or not
        // Can be omitted and defaults to false
        "conditional": false,
        // The damage of the bullet will be reduced by this amount after piercing
        // Can be omitted and defaults to 0.0
        "damage_falloff": 0.0,
        // The damage of the bullet will be multiplied by this amount after piercing
        // Can be omitted and defaults to 1.0
        "damage_multiplier": 1.0,

        // With the "count" pierce type, bullets will pierce *one less time* than the specified amount
        // Meaning the value of 1 will NOT pierce, and the value of 2 will pierce only once
        // This awkwardness is to maintain consistency with how TaCZ treats their "pierce" value
        "type": "count",
        "count": 3,
        // Whether it requires the block to be broken in order to pierce or not
        // Can be omitted and defaults to false
        "conditional": false,
        // The damage of the bullet will be reduced by this amount after piercing
        // Can be omitted and defaults to 0.0
        "damage_falloff": 0.0,
        // The damage of the bullet will be multiplied by this amount after piercing
        // Can be omitted and defaults to 1.0
        "damage_multiplier": 1.0,

        // With the "damage" pierce type, bullets will pierce blocks as long as its damage is more than 0
        "type": "damage",
        // Whether it requires the block to be broken in order to pierce or not
        // Can be omitted and defaults to false
        "conditional": false,
        // The damage of the bullet will be reduced by this amount after piercing
        // Can be omitted and defaults to 0.0
        "damage_falloff": 0.0,
        // The damage of the bullet will be multiplied by this amount after piercing
        // Can be omitted and defaults to 1.0
        "damage_multiplier": 1.0
    },
    // Specifies how it interacts with the TaCZ' default `pierce` stats
    "gun_pierce": {
        // Whether the `pierce` value is required or not
        // Can be omitted and defaults to false
        "required": false,
        // Whether the `pierce` value is consumed after piercing or not
        // Can be omitted and defaults to false
        "consume": false
    },
    // Specifies the priority of this interaction
    // If multiple interactions share the same priority, they are prioritized in this order:
    //   1. Those with both `target` and `blocks` specified
    //   2. Those with only `target` specified
    //   3. Those with only `blocks` 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 Interactions

In entity interactions, you can make bullets pierce certain entities.

{
    "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 interactions are applicable
    "target": {
        "type": "gun",
        "values": [
            "tacz:m320"
        ],
    },
    // Specifies the target entities for this interaction, 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 interactions are applicable
    "entities": [
        "minecraft:creeper",
        "#minecraft:skeletons",
        {
            "type": "health",
            "unit": "raw",
            "range": {
                "max": 5.0
            }
        }
    ],
    // Specifies the damage modifier for this interaction
    "damage": {
        // Modifies the damage by this value
        // Can be omitted and defaults to 0.0
        "modifier": 0.0,
        // Multiplies the damage by this value
        // Can be omitted and defaults to 1.0,
        "multiplier": 1.0,
    },
    // Specifies when and how bullets bullets pierce entities
    // The "damage" type is the one you will use the most
    "pierce": {
        // With the "never" pierce type, bullets will never pierce entities
        "type": "never",

        // With the "default" pierce type, bullets will pierce entities as long as other conditions are met
        "type": "default",
        // Whether it requires the entity to be killed in order to pierce or not
        // Can be omitted and defaults to false
        "conditional": false,
        // The damage of the bullet will be reduced by this amount after piercing
        // Can be omitted and defaults to 0.0
        "damage_falloff": 0.0,
        // The damage of the bullet will be multiplied by this amount after piercing
        // Can be omitted and defaults to 1.0
        "damage_multiplier": 1.0,

        // With the "count" pierce type, bullets will pierce *one less time* than the specified amount
        // Meaning the value of 1 will NOT pierce, and the value of 2 will pierce only once
        // This awkwardness is to maintain consistency with how TaCZ treats their "pierce" value
        "type": "count",
        "count": 3,
        // Whether it requires the entity to be killed in order to pierce or not
        // Can be omitted and defaults to false
        "conditional": false,
        // The damage of the bullet will be reduced by this amount after piercing
        // Can be omitted and defaults to 0.0
        "damage_falloff": 0.0,
        // The damage of the bullet will be multiplied by this amount after piercing
        // Can be omitted and defaults to 1.0
        "damage_multiplier": 1.0,

        // With the "damage" pierce type, bullets will pierce entities as long as its damage is more than 0
        "type": "damage",
        // Whether it requires the entity to be killed in order to pierce or not
        // Can be omitted and defaults to false
        "conditional": false,
        // The damage of the bullet will be reduced by this amount after piercing
        // Can be omitted and defaults to 0.0
        "damage_falloff": 0.0,
        // The damage of the bullet will be multiplied by this amount after piercing
        // Can be omitted and defaults to 1.0
        "damage_multiplier": 1.0
    },
    // Specifies how it interacts with the TaCZ' default `pierce` stats
    "gun_pierce": {
        // Whether the `pierce` value is required or not
        // Can be omitted and defaults to false
        "required": false,
        // Whether the `pierce` value is consumed after piercing or not
        // Can be omitted and defaults to false
        "consume": false
    },
    // Specifies the priority of this interaction
    // If multiple interactions 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
}
⚠️ **GitHub.com Fallback** ⚠️