Skip to content

Melee Interactions

MUKSC edited this page Aug 24, 2025 · 1 revision

Using melee interactions, you can customize how melee attacks will interact with blocks.
Compatible with the LesRaisins Tactical Equipements mod as well.
In order to define a melee 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 melee interaction must be defined in a directory named melee_interactions.
For example: data/example/melee_interactions/example_interaction.json

There are 1 type of melee interactions: block, which are specified by the type field.

Block Interactions

In block interactions, you can make melee attacks 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 melee attacks destroy blocks
    // The "dynamic_damage" type is the one you will use the most
    "block_break": {
        // With the "never" block break type, melee attacks will never break blocks
        "type": "never",

        // With the "instant" block break type, melee attacks 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, melee attacks 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, melee attacks 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, melee attacks 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 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
}

Clone this wiki locally