For the complete documentation index, see llms.txt. This page is also available as Markdown.

Custom Mechanic

This mechanism allows you to realize an extremely customizable mechanism without programming

How does it work?

This mechanic is for items only and does not work with blocks/furniture. For that check the clickAction mechanic. The mechanics let you create subsections composed of 3 parts:

  • Event: when is this mechanic triggered? e.g. when you right-click on a block

  • Conditions: a set of conditions that must be satisfied. e.g. having a permission

  • Actions: a set of actions to perform. e.g. send a command or a message

An optional settings called one_usage allows you to imitate the use of an item at 1.

A comprehensive example

myitem:
  Mechanics:
    custom:
      test:
        one_usage: false
        event: "CLICK:right:all"
        conditions:
          - '#player.hasPermission("example.permission")'
        actions:
          - "[console] give <player> cooked_beef 1"

In this example, the subsection test defines a custom mechanic triggered when someone right click (on a block or in the air). If this player has the permission example.permission, the console will perform the give command and replace <player> by the player name. The item won't be consumed (one_usage: false).

Available events

CLICK:click_type:target_type,

INV_CLICK:click_type:context_type

DROP, PICKUP, BREAK, EQUIP, UNEQUIP, INV_CLICK, DEATH, DROP_ALL

Available conditions

Permission-Condition

Available actions

Command-Action

This action lets you run a command either from console or as the player

Message-Action

ActionBar-Action

Sound-Action

This action lets you play a sound at a location or at a target with customizable values

source - The source of the sound (List of sources) volume - The volume to play the sound with pitch - The pitch to play the sound with self - If the sound sound be played at the Player and not at a location

Followed by the sound-key to play

Last updated