Skip to main content

๐Ÿช‡ Events

Introductionโ€‹

The events section determines which item/furniture/block will execute predefined behaviors during specific events. Under the events section, you need to specify an event trigger, such as "right_click" for a right-click action. Below the event trigger, you must pass a list of actions with their corresponding types. For example, command executes a specific command.

# format 1
events:
right_click:
- type: command
command: say 1
conditions:
- type: permission
permission: "craftengine.admin"
- type: command
command: say 2
conditions: []
# format 2
events:
- on: right_click
functions:
- type: command
command: say 1
conditions:
- type: permission
permission: "craftengine.admin"
- type: command
command: say 2
conditions: []

๐Ÿงจ Event Triggersโ€‹

itemsโ€‹

  • break
  • right_click
  • left_click
  • consume

blocksโ€‹

  • break
  • place
  • right_click
  • left_click
  • step

Furnitureโ€‹

  • break
  • place
  • right_click
caution

Please note that the corresponding events should be placed in the appropriate configuration area. For example, if you want to execute a command when interacting with a piece of furniture, the correct approach is to place the events under the furniture section, not under your item section.

items:
default:bench:
events: # โŒ๏ธ
right_click:
- type: command
behavior:
type: furniture_item
furniture:
events: # โœ…๏ธ
right_click:
- type: command

๐Ÿ”ง Functionsโ€‹

cancel_eventโ€‹

Cancels the original event.

type: cancel_event

runโ€‹

Runs a list of functions in order. It's useful for functions that share the same conditions.

type: run
delay: 0 # optional; number; [default: 0]
functions: # required; maplist
- type: command
- type: message

commandโ€‹

Runs a command as a player or console.

type: command
command: "say hello <arg:player.name>" # required; stringlist/string
target: "self" # optional; enum[all,self]/player selector; [default: self]
as-player: false # optional; [default: false]

messageโ€‹

Sends a message/system actionbar message

type: message
message: "Hello <papi:player_name>" # required; string list/string
target: "self" # optional; enum[all,self]/player selector
overlay: false # optional; [default: false]; false = chat box / true = actionbar

actionBarโ€‹

Sends an actionbar

type: actionbar
actionbar: "This is an action bar" # required; string
target: "self" # optional; enum[all,self]/player selector; [default: self]

Titleโ€‹

Sends a title

type: title
title: "<red>Title</red>" # required; string
subtitle: "<Yellow>Subtitle</yellow>" # required; string
fade-in: 20 # optional; number; [default: 10]
stay: 10 # optional; number; [default: 20]
fade-out: 10 # optional; number; [default: 5]

open_windowโ€‹

Opens a gui window

type: open_window #
gui-type: anvil # required; enum[anvil, enchantment, grindstone, loom, smithing, crafting, cartography];
title: "Super Anvil" # optional; string
target: "self" # optional; enum[all,self]/player selector; [default: self]

place_blockโ€‹

Places a block

type: place_block
block-state: "default:chinese_lantern"
x: <arg:block.block_x>
y: <arg:block.block_y>
z: <arg:block.block_z>

drop_lootโ€‹

Drops loots based on the give loot table

type: drop_loot
x: <arg:block.block_x> + 0.5
y: <arg:block.block_y> + 0.5
z: <arg:block.block_z> + 0.5
loot:
pools: ...

update_interaction_tickโ€‹

Updates the tick when the last interaction ends

type: update_interaction_tick

set_countโ€‹

Sets the count of the current item in this event

type: set_count
add: true # Default: false
count: -1
target: "self" # optional; enum[all,self]/player selector

set_foodโ€‹

Sets the food level (0~20) of the player

type: set_food
add: true
food: 4
target: "self" # optional; enum[all,self]/player selector

set_saturationโ€‹

Sets the saturation(0~10) of the player

type: set_saturation
add: true
saturation: 2.5
target: "self" # optional; enum[all,self]/player selector

swing_handโ€‹

Swings the hand involved in this event or the hand specified in config

type: swing_hand
hand: main_hand # Optional Argument

particleโ€‹

Spawns a particle

type: particle
particle: minecraft:end_rod
x: "<arg:position.x>"
y: "<arg:position.y>"
z: "<arg:position.z>"
count: 5
offset-x: 0.3
offset-y: 0.3
offset-z: 0.3
speed: 0

# The following arguments are only effective
# when the particles are of a certain type.

# item
item: default:chinese_lantern

# block/falling_dust/dust_pillar/block_crumble/block_marker
block-state: default:plam_log[axis=y]

# charge
charge: 1.5

# shriek
shriek: 1

# dust
color: 255,255,255
scale: 1.0

# dust_color_transition
from: 255,255,255
to: 0,0,0
scale: 4.0

# vibration
target-x: 0
target-y: 1
target-z: 0
arrival-time: 10

# trail
target-x: 0
target-y: 1
target-z: 0
duration: 10

potion_effectโ€‹

Adds a potion effect

type: potion_effect
potion-effect: minecraft:blindness
duration: 20 # Default: 20
amplifier: 0 # Default: 0
ambient: false # from beacon
particles: true

remove_potion_effectโ€‹

Removes a potion effect

type: remove_potion_effect
potion-effect: minecraft:blindness # Optional if 'all' is true
all: false # Default: false

leveler_expโ€‹

Adds skill/job experience

type: leveler_exp
plugin: AuraSkills # The leveler plugin
leveler: fishing # the job/skill id
count: 10 # the amount of exp to give

set_cooldownโ€‹

Sets cooldown for player

type: set_cooldown
time: 1m30s
id: my_cooldown_id
add: false # Default: false (Whether to accumulate cooldown time)

remove_cooldownโ€‹

Removes cooldown for player

type: remove_cooldown
id: my_cooldown_id # Optional if 'all' is true
all: false # Default: false

play_soundโ€‹

Plays a sound

type: play_sound
sound: minecraft:xxxx.xxx
x: <arg:position.x> # Optional if 'target' is specified
y: <arg:position.y> # Optional if 'target' is specified
z: <arg:position.z> # Optional if 'target' is specified
target: "self" # optional; enum[all,self]/player selector
pitch: 1
volume: 1
source: master

mythic_mobs_skillโ€‹

Cast a mythic mobs skill

type: mythic_mobs_skill
skill: skill_id
power: 1.0

spawn_furnitureโ€‹

Spawns a furniture

type: spawn_furniture
furniture-id: "default:bench"
x: <arg:position.x> # Default: <arg:position.x>
y: <arg:position.y> # Default: <arg:position.y>
z: <arg:position.z> # Default: <arg:position.z>
pitch: <arg:pitch> # Default: <arg:pitch>
yaw: <arg:yaw> # Default: <arg:yaw>
anchor-type: ground # optional; enum[ground,ceiling,wall]
play-sound: true # Default: true

remove_furnitureโ€‹

Removes a furniture

type: remove_furniture
drop-loot: true # Default: true
play-sound: true # Default: true

replace_furnitureโ€‹

Replaces a furniture

type: spawn_furniture
furniture-id: "default:bench"
x: <arg:position.x> # Default: <arg:position.x>
y: <arg:position.y> # Default: <arg:position.y>
z: <arg:position.z> # Default: <arg:position.z>
pitch: <arg:pitch> # Default: <arg:pitch>
yaw: <arg:yaw> # Default: <arg:yaw>
anchor-type: ground # optional; enum[ground,ceiling,wall]
drop-loot: true # Default: true
play-sound: true # Default: true
info

More functions are coming...