Skip to content

Modify Block Use

Modifies the interaction of a block.

Type ID: kaya:modify/block/use

Info

This type provides the following context parameters:

Parameter Description
kaya:used_block The block which the player interacted with.
kaya:used_side The side of the block the player interacted with.
kaya:used_item_slot The item slot used for interacting with the player.
kaya:used_item The item stack used for interacting with the player.

Format

Field Type Default Description
action Action optional If specified, this action will be executed when the player interacts with a block.
result Interaction Result "success" Determines the result of the player's interaction with a block.
directions Array of Directions ["down", "up", "north", "south", "west", "east"] Determines whether to trigger instances of this type when the player interacts with the specified sides of a block.
hands Array of Hands ["main_hand", "off_hand"] Determines whether to trigger instances of this type when the player interacts with a block with the specified hands.
use_phases Array of Block Use Phases ["block", "block_with_item"] Determines whether to trigger instances of this type when the player's interaction with a block enters the specified phases.
priority Integer 0 Determines the order of which instances of this type is checked and executed.
About priorities

The instances of this type will be sorted in its reversed natural order meaning that instances that have a higher priority value will be checked and executed first before those that have lower priority values.

This instance also has specific rules with specific values of priorities:

  • If the priority value is equal or greater than 1, the instance will be executed and override the result of the interaction.
  • If the priority value is equal or less than -1, the instance will only be executed if the previous interaction result is a pass.
  • If the priority value is equal to 0, the instance will be executed and will not override the end result.

Example

{
    "type": "kaya:modify/block/use",
    "action": {
        "type": "kaya:execute_command",
        "source": {
            "type": "kaya:entity",
            "entity": "this"
        },
        "command": "tellraw @s {\"text\": \"You cannot open chests made of copper!\", \"color\": \"red\"}"
    },
    "result": "fail",
    "priority": 1,
    "active_condition": {
        "type": "kaya:check_block_type",
        "tag": "#minecraft:copper_chests",
        "block": "used_block"
    }
}

This example prevents the player from opening a copper chest (or any blocks included in the #minecraft:copper_chests tag).

History

Minecraft Mod Changelog
1.21.5 0.1.0 Added the type.