Create abilities

How to create abilities

To create an item ability you can add a code to run for a specific action, for example: item.setLeftAction(core.createRunnable("<code>")) // The "<code>" will run when the player will left click with this item. You will also have another special variable for each action, the "event" variable is the event it self (used to cancel it, etc)

Here is the action list:

item.setLeftAction(core.createRunnable("")) // Left click action
item.setLeftSAction(core.createRunnable("")) // Shift left  click action
item.setRightAction(core.createRunnable("")) // Right click action
item.setRightSAction(core.createRunnable("")) // Shift right click action
item.setShiftAction(core.createRunnable("")) // Shift action, if the item is an armor piece the code will run only if the armor is equipped
item.setDropAction(core.createRunnable("")) // Drop action
item.setSwapAction(core.createRunnable("")) // Swap items action (the "item" variable is the item on the second hand after the swap. 1.9+)
item.setShootAction(core.createRunnable("")) // When entity shoots a projectile with this item (the "player" variable is replaced with "shooter")
item.setPickupAction(core.createRunnable("")) // When a player picks up the item
item.setArrowLandAction(core.createRunnable("")) // When arrow lands (Instead of the variable "player" there will be the variable "shooter" which is a LivingEntity) Special variable "landLocation" is the location that the arrow landed at.

You can have multiple actions for one item.

Last updated