---
description: Add special behaviour on your items based on some events
---

# Events

```yaml
events:
    shift_right_click: #when you press shift+right click
        #....
    right_click: #when you right click
        #....
    shift_left_click: #when you shift+left click
        #....
    left_click: #when you left click
        #....
    attack: #when you attack a mob/player
        #...
    block_break: #when you break a block using this item or another one (depends)
                 #scroll down for more info
        #...
    fishing: #when you catch a fish with fishing rod
        #...
    kill_mob: #when you kill a mob
        #...
    wear: #when you wear an armor piece or hat
        #...
    unwear: #when you unwear an armor piece or hat
        #...
    held: #when set item in main hand to this custom item (hotbar)
        #...
    unheld: #when you change item in main hand
        #...
    drop: #when you drop this item
        #...
    pickup: #when you pickup this item
        #...
```

### Events: actions

Now that you know which events can be triggered you have to configure what happens&#x20;

```yaml
events:
    right_click:
        play_sound: knife
        play_particle: CRIT_MAGIC
        play_effect: SMOKE
        #you can create multiple rules for potion_effect
        #you just have to make the rule start with "potion_effect"
        potion_effect_1:
            type: HEAL
            duration: 200
            amplifier: 4
        potion_effect_2:
            type: UNLUCK
            duration: 200
            amplifier: 4
        #you can create multiple rules for remove_potion_effect
        #you just have to make the rule start with "remove_potion_effect"
        remove_potion_effect_1:
            type: GLOWING
        remove_potion_effect_2:
            type: HEAL
        execute_command:
            as_console: true
            #{player} will be automatically replaced with player name
            command: 'tellraw {player} {"text":"Pressed right mouse button","color":"gold"}'
        give_item: # give item to player
            item: empty_cup #material or custom item
        reduce_durability: 1
        reduce_amount: 1
        reduce_usages: 1
        replace_near_blocks:
            reduce_durability: 1
            radius:
              x: 2
              y: 2
              z: 2
            from: LAVA
            to: OBSIDIAN
        #you can create multiple rules for replace_near_blocks
        #you just have to make the rule start with "replace_near_blocks"
        replace_near_blocks_1:
            # ....
        replace_near_blocks_2:
            # ....
        replace_near_blocks_...:
            # ....
    block_break:
        drop_this_item: #when you break a block using any tool drops this custom item
            from_block: 
                FERN: #block broken
                    chance: 10       #chance of dropping this custom item
                    min_amount: 1    #min amount of this custo item to be dropped
                    max_amount: 2    #min amount of this custo item to be dropped
                    cancel_on_silktouch: true
                    need_pickaxe: false
                GRASS: #another block broken
                    chance: 10       #chance of dropping this custom item
                    min_amount: 1    #min amount of this custo item to be dropped
                    max_amount: 2    #min amount of this custo item to be dropped
                    cancel_on_silktouch: true
                    need_pickaxe: false
                #.... you can add more blocks if you need
                #..........
        drop_exp: #when you break a block holding this custom item item in hand
                    #drop exp
            chance: 50       #chance of dropping the exp
            min_amount: 1    #min exp amount
            max_amount: 3    #max exp amount
        multiple_break: #special property: breaks more than one block around the first
            keep_ores: true #are ores protected from the 3x3 break tool?
            drop_all_blocks: #if all blocks should be dropped on break or only the first
              enabled: true
              need_silk_touch: true #if you need silktouch to get all blocks
            size: 3 #size of the square to be mined
            depth: 1 #depth of the square to be mined
    fishing: #special event called when you fish
         drop_this_item: #drop the current item
            chance: 20 #chances of getting the tuna dropped
    kill_mob: #when you kill a witch it drops this item with 20% of chance
      drop_this_item:
        from_mob: 
            WITCH:
                chance: 20
    throw: #special event called when you throw a throwable item
        # ... refer to Throwables page, link on bottom of this page
    hit_ground: #special event called when a throwable item hits the ground
        # ... refer to Throwables page, link on bottom of this page
    
        
```

{% content-ref url="../specific-items/throwables" %}
[throwables](../specific-items/throwables)
{% endcontent-ref %}
