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
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
, , , , , , ,
Available conditions
HAS_PERMISSION:the.permission
the.permission: The permission required by the player using the item
Available actions
Command-Action
This action lets you run a command either from console or as the player
myitem:
Mechanics:
custom:
mycustom:
event: "CLICK:right:all"
actions:
- "[console] minecraft:give <player> minecraft:paper 2"
Message-Action
This action lets you send a Message to the player with a customizable message
myitem:
Mechanics:
custom:
mycustom:
event: "CLICK:right:all"
actions:
- "[message] <red>some message <gradient:red:blue>with MiniMessage support"
ActionBar-Action
This action lets you send an ActionBar to the player with a customizable message
myitem:
Mechanics:
custom:
mycustom:
event: "CLICK:right:all"
actions:
- "[actionbar] <red>some message <gradient:red:blue>with MiniMessage support"
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
myitem:
Mechanics:
custom:
mycustom:
event: "CLICK:right:all"
actions:
- "{source=AMBIENT volume=0.1 pitch=1} [sound] namespace:soundkey"
Last updated