Skip to content

Callback Block Place

Invokes an action upon the player placing a block.

Type ID: kaya:callback/block/place

Info

This type provides the following context parameters:

Parameter Description
kaya:placed_on_block The block the player placed a block on.
kaya:placed_to_block The block the player placed.
kaya:placed_side The side of the block the player placed on.

Format

Field Type Default Description
on_place_action Action The action to invoke when a block is placed.
directions Array of Directions ["down", "up", "north", "south", "west", "east"] Determines if the action is invoked when the block is placed at the specified sides.
hands Array of Hands ["main_hand", "off_hand"] Determines if the action should be invoked when the block is held and placed with the specified hands.
priority Integer 0 Determines the order of which powers of this type will be iterated.
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 executed first before those that have lower priority values.

Example

{
    "type": "kaya:callback/block/place",
    "on_place_action": [
        {
            "type": "kaya:bone_meal",
            "position": {
                "type": "kaya:block/position",
                "block": "kaya:placed_to_block"
            }
        },
        {
            "type": "kaya:apply_effects",
            "effects": [
                {
                    "id": "minecraft:regeneration",
                    "amplifier": 1,
                    "duration": 80
                }
            ]
        }
    ],
    "active_condition": {
        "type": "kaya:check_block_type",
        "tag": "#minecraft:flowers",
        "block": "placed_to_block"
    }
}

This example applies a bone meal effect to where the block was placed and gives the player the Regeneration II (00:04) effect upon placing any kind of flowers (or any block included in the #minecraft:flowers block tag.)

History

Minecraft Mod Changelog
1.21.5 0.1.0 Added the type.