Event System - creoii/Custom Wiki

Home

The event system allows creators to add functionality to their custom blocks, items, enchantments, etc.

Each event has a list of conditions to check and effects to run if successful. Some events, conditions, and effects will not work on certain custom objects. Take a look at Global Events as well!

Example

The events array is currently applicable to custom blocks, items, enchantments, and status effects.

"events": [
  {
    "type": "right_click",
    "action_result": "success",
    "swing_hand": true,
    "conditions": [
      {
        "type": "holding_item",
        "item": "minecraft:stick"
      }
    ],
    "effects": [
      {
        "type": "spawn_entity",
        "entity_type": "minecraft:evoker"
      }
    ]
  }
]

Events:

Go to the Events page for more information.

none: no event

right_click: fired when a player right clicks the block

left_click: fired when a player left clicks the block

stepped_on: fired when a living entity steps on the block

projectile_hit: fired when a projectile hits the block

place_block: fired when the block is placed

break_block: fired when the block is broken

target_damaged: fired when the target is damaged

user_damaged: fired when the user is damaged

entity_lands: fired when a living entity lands on the block

entity_collision: fired when a living entity collides with the block

neighbor_update: fired when a neighbor update is called on the block

crafted: fired when an item is crafted

random_tick: fired every random tick

Conditions:

Go to the Event Conditions page for more information.

none: no conditions

holding_item: passes if the held item matches the condition item

in_tag: passes if the object is in the given tag

random_chance: passes if the randomly chosen number is less than the chance.

biome_matches: passes if the object is in the biome, also checking for biome categories and precipitation

difficulty_matches: passes if the world difficulty matches the checked difficulty

gamemode_matches: passes if the entity is a player and their gamemode matches the checked gamemode

entity_sneaking: passes if the given entity is sneaking

entity_sprinting: passes if the given entity is sprinting

entity_swimming: passes if the given entity is swimming

has_enchantment: passes if the given equipment slot has the given enchantment

has_status_effect: passes if the entity has the given status effect

player_level_within: passes if the players level is within the level range

time_within: passes if the world time is within the time range

weather_matches: passes if the current weather matches the given weather

within_y: passes if the entity is within the y-level range

composite: passes if both input conditions return true

keybinding_pressed: passes if the keybinding is currently pressed

Effects:

Go to the Event Effects page for more information.

none: no effect

drop_item: drops an item

spawn_entity: spawns an entity

heal: heals the user or target

add_velocity: adds velocity to the entity

destroy: breaks a block, kills an entity, removes an item