Hooks

From LuaCraft
Jump to: navigation, search

Contents

Shared

command.run(Player player, String command, Table arguments)

  • Information: Calls whenever a command is ran
  • Return value: nil

entity.attacked(Entity target, DamageSource source, Number damage)

  • Information: Called when an entity attacks another entity
  • Return value: Boolean cancel

entity.death(Entity target, DamageSource source, Number damage)

  • Information: Called when an entity is killed
  • Return value: Boolean cancel

entity.dropall(Entity entity, Table drops, Number lootLevel, Boolean hitRecent)

  • Information: Called when a entity dies and drops all their loot
  • Return value: Boolean cancel

entity.fall(Entity entity, Number distance)

  • Information: Called when an entity falls to the ground
  • Return value: Boolean cancel

entity.jump(Entity entity, Number distance)

  • Information: Called when an entity falls to the ground
  • Return value: Boolean cancel

entity.lightning(Entity target, Entity lightning)

  • Information: Called when an entity is struck by lightning
  • Return value: Boolean cancel

entity.removed(Entity entity)

  • Information: Called when an entity gets removed from the world
  • Return value: Boolean cancel

entity.spawned(Entity entity)

  • Information: Called when an entity attempts to spawn into the world
  • Return value: Boolean cancel

entity.update(Entity entity)

  • Information: Called when an entity is updated
  • Return value: nil

input.keypress(Number key, Boolean repeat)

  • Information: Calls whenever a key is pressed
  • Return value: nil

input.mousepress(Number key)

  • Information: Calls whenever a mouse button is pressed
  • Return value: nil

item.expired(EntityItem item)

  • Information: Called when an item gets cleaned up from the world, after being on the ground for too long
  • Return value: Boolean cancel

lua.error(String error, Table trace)

  • Information: Calls whenever a Lua error occurs
  • Return value: Boolean print

player.changedimension(Player player, Number fromID, Number toID)

  • Information: Called whenever a player attempts to go to a new dimension
  • Return value: Boolean cancel

player.connect(Player player)

  • Information: Called when a player connects to the server
  • Return value: nil

player.craftitem(Player player, ItemStack stack)

  • Information: Called whenever a player crafts a new item
  • Return value: Boolean cancel

player.destroyitem(Player player, ItemStack original)

  • Information: Called when a player destroys an item in their inventory, normally when completing an action
  • Return value: Boolean cancel

player.disconnect(Player player)

  • Information: Called when a player disconnects from the server
  • Return value: nil

player.dropall(Player player, Table drops, Number lootLevel, Boolean hitRecent)

  • Information: Called when a player dies and drops all their loot
  • Return value: Boolean cancel

player.dropitem(Player player, EntityItem item)

  • Information: Called when a player drops an item on the ground
  • Return value: Boolean cancel

player.interact(Player player, Entity entity)

  • Information: Called when a player attempts to interact with another entity
  • Return value: Boolean cancel

player.mineblock(Player player, Block block, Vector normal)

  • Information: Called when a player attempts to mine a block
  • Return value: Boolean cancel

player.opencontainer(Player player, Boolean interact)

  • Information: Called when a player attempts to open a container such as a chest
  • Return value: RESULT result

player.pickupitem(Player player, EntityItem item)

  • Information: Called whenever a player picks up an item
  • Return value: RESULT result

player.pickupxp(Player player, Entity orb)

  • Information: Called when a player attempts to pickup XP orbs
  • Return value: Boolean cancel

player.placeblock(Player player, Block block, Vector normal)

  • Information: Called when a player attempts to place a block
  • Return value: Boolean cancel

player.rightclick(Player player, Block block, Vector normal)

  • Information: Called when a player presses right mouse on nothing
  • Return value: Boolean cancel

player.say(Player player, String message)

  • Information: Called when a player types something in chat
  • Return value: Boolean cancel

player.smeltitem(Player player, ItemStack stack)

  • Information: Called whenever a player smelts an item in a furnace
  • Return value: Boolean cancel

player.spawned(Player player)

  • Information: Called when a player spawns for the first time
  • Return value: nil

Client

input.mousemove(Number button, Number x, Number y)

  • Information: Calls whenever the mouse is moved
  • Return value: nil

mainmenu.init()

  • Information: Called when the main menu is initialized
  • Return value: nil

player.postrender(Player player)

  • Information: Called after the player is drawn
  • Return value: nil

player.prerender(Player player)

  • Information: Called before the player is drawn
  • Return value: nil

render.gameoverlay(Number ticks, Number x, Number y)

  • Information: Calls whenever a frame is drawn Used for rendering 2D text, textures, etc.
  • Return value: nil

render.world(Number ticks)

  • Information: Calls whenever a frame within the world is drawn Used for rendering 3D objects
  • Return value: nil