Wizards of Lua

The Art of Spell Crafting


UseItemStartEvent - When an Entity Starts Using an Item

The UseItemStartEvent class is fired when a Mob or Player starts using an Item. Setting the duration to zero or less cancels this event.

Example

Prevent those nasty skeletons from shooting you.

Events.on('UseItemStartEvent'):call(function(event)
  if event.entity.name == 'Skeleton' then
    event.canceled = true
  end
end)

The UseItemStartEvent class is a subtype of the UseItemEvent class and inherits all its properties and functions.