Wizards of Lua

The Art of Spell Crafting


LeftClickBlockEvent - When a Player Left-Clicks on a Block

The LeftClickBlockEvent class is fired when a player left-clicks at some block.

The LeftClickBlockEvent class is a subtype of the PlayerInteractEvent class and inherits all its properties and functions.

Here is an overview of the LeftClickBlockEvent properties:

Property Type read / write
hitVec Vec3 r

Properties

Below you find short descriptions about each of the properties and some examples about how to use them in your spells.


hitVec : Vec3

The exact position the player clicked at.

Example

Creating some particle effect at the left-click hit position.

local queue = Events.collect("LeftClickBlockEvent")
while true do
  local event = queue:next()
  local v = event.hitVec
  spell:execute([[
    /particle angryVillager %s %s %s 0 0 0 0 1 true
  ]], v.x, v.y, v.z)
end