---@meta _
---@diagnostic disable: duplicate-set-field


---==================================================================================================================---
---  EVENTSAPI                                                                                                       ---
---==================================================================================================================---

---An API that contains all of the in-game events that Figura handles.
---
---Events can have callback functions registered to them which will run when the event does.
---@class EventsAPI
---This event runs every frame for every arrow the avatar's owner has fired.
---> ```lua
---> (callback) function(delta: number, entity: Entity)
--->   -> hide: boolean?
---> ```
---> ***
---> A callback that is given the current tick delta and the arrow that is being rendered.
--->
---> Return `true` to completely hide the current arrow.
---@field ARROW_RENDER Event.ArrowRender | Event.ArrowRender.func
---This event runs every frame for every arrow the avatar's owner has fired.
---> ```lua
---> (callback) function(delta: number, entity: Entity)
--->   -> hide: boolean?
---> ```
---> ***
---> A callback that is given the current tick delta and the arrow that is being rendered.
--->
---> Return `true` to completely hide the current arrow.
---@field arrow_render Event.ArrowRender | Event.ArrowRender.func
---This event runs for every character typed on the keyboard.
---> ```lua
---> (callback) function(char: string, modifiers: integer, codepoint: integer)
---> ```
---> ***
---> A callback that is given the string representation of the typed character, the active modifier keys as a bitmask,
---> and the codepoint of the typed character.
---@field CHAR_TYPED Event.CharTyped | Event.CharTyped.func
---This event runs for every character typed on the keyboard.
---> ```lua
---> (callback) function(char: string, modifiers: integer, codepoint: integer)
---> ```
---> ***
---> A callback that is given the string representation of the typed character, the active modifier keys as a bitmask,
---> and the codepoint of the typed character.
---@field char_typed Event.CharTyped | Event.CharTyped.func
---This event runs every time a message is received in chat.  
---The message can be modified by the callbacks in this event.
---
---Avoid sending anything to the chat during this event as it will create an infinite loop.
---> ```lua
---> (callback) function(message: string, json: string)
--->   -> replace: (string|false)?
--->   2. bgcolor: Vector3?
---> ```
---> ***
---> A callback that is given a received chat message's contents.
--->
---> Return a string to replace the message, `false` to remove the message, or `nil` to do nothing.  
---> If a color vector is given as the second return, the background color of the message is changed.
---@field CHAT_RECEIVE_MESSAGE Event.ChatReceiveMessage | Event.ChatReceiveMessage.func
---This event runs every time a message is received in chat.  
---The message can be modified by the callbacks in this event.
---
---Avoid sending anything to the chat during this event as it will create an infinite loop.
---> ```lua
---> (callback) function(message: string, json: string)
--->   -> replace: (string|false)?
--->   2. bgcolor: Vector3?
---> ```
---> ***
---> A callback that is given a received chat message's contents.
--->
---> Return a string to replace the message, `false` to remove the message, or `nil` to do nothing.  
---> If a color vector is given as the second return, the background color of the message is changed.
---@field chat_receive_message Event.ChatReceiveMessage | Event.ChatReceiveMessage.func
---This event runs every time the host sends a message to chat.  
---The message can be modified by the callbacks in this event.
---
---When the message is changed, it is changed for every callback after it. This means that, for
---example, returning `nil` will cause all callbacks after it to have a `message` argument of `nil`.
---> ```lua
---> (callback) function(message?: string)
--->   -> replace: string?
---> ```
---> ***
---> A callback that is given the contents of a message the avatar owner is about to send.
--->
---> Return a string to replace the message (only if the `Chat Messages` setting is enabled) or `nil` to block the
---> message.  
---> If you return `message` without any modifications, nothing happens.
---@field CHAT_SEND_MESSAGE Event.ChatSendMessage | Event.ChatSendMessage.func
---This event runs every time the host sends a message to chat.  
---The message can be modified by the callbacks in this event.
---
---When the message is changed, it is changed for every callback after it. This means that, for
---example, returning `nil` will cause all callbacks after it to have a `message` argument of `nil`.
---> ```lua
---> (callback) function(message?: string)
--->   -> replace: string?
---> ```
---> ***
---> A callback that is given the contents of a message the avatar owner is about to send.
--->
---> Return a string to replace the message (only if the `Chat Messages` setting is enabled) or `nil` to block the
---> message.  
---> If you return `message` without any modifications, nothing happens.
---@field chat_send_message Event.ChatSendMessage | Event.ChatSendMessage.func
---This event runs as soon as the avatar's owner loads in.
---
---As soon as this event starts running, it is safe to use the `player` global variable to access information about the
---avatar's owner.
---> ```lua
---> (callback) function()
---> ```
---> ***
---> A callback that does nothing special, it just runs whenever the event it is attached to runs.
---@field ENTITY_INIT Event.Generic | Event.Generic.func
---This event runs as soon as the avatar's owner loads in.
---
---As soon as this event starts running, it is safe to use the `player` global variable to access information about the
---avatar's owner.
---> ```lua
---> (callback) function()
---> ```
---> ***
---> A callback that does nothing special, it just runs whenever the event it is attached to runs.
---@field entity_init Event.Generic | Event.Generic.func
---This event runs every frame for every item equipped on the avatar's owner.  
---The item can be replaced with a model by the callbacks in this event.
---> ```lua
---> (callback) function(item: ItemStack, mode: string, pos: Vector3, rot: Vector3, scale: Vector3, lefthanded: boolean)
--->   -> replace: ModelPart?
---> ```
---> ***
---> A callback that is given an item being rendered, the rendering mode of the item, the transformations applied to the
---> item, and whether the current rendering mode is left-handed.
--->
---> Returning a model part will cause the item to be completely replaced with the given part.  
---> The model part *must* have the `Item` parent type for this to work.
---@field ITEM_RENDER Event.ItemRender | Event.ItemRender.func
---This event runs every frame for every item equipped on the avatar's owner.  
---The item can be replaced with a model by the callbacks in this event.
---> ```lua
---> (callback) function(item: ItemStack, mode: string, pos: Vector3, rot: Vector3, scale: Vector3, lefthanded: boolean)
--->   -> replace: ModelPart?
---> ```
---> ***
---> A callback that is given an item being rendered, the rendering mode of the item, the transformations applied to the
---> item, and whether the current rendering mode is left-handed.
--->
---> Returning a model part will cause the item to be completely replaced with the given part.  
---> The model part *must* have the `Item` parent type for this to work.
---@field item_render Event.ItemRender | Event.ItemRender.func
---This event runs when a key is pressed, held, or released.
---> ```lua
---> (callback) function(key: integer, state: integer, modifiers: integer)
--->   -> cancel: boolean?
---> ```
---> ***
---> A callback that is given the id of a key being pressed, the press state of the key, and the active modifier keys as
---> a bitmask.
--->
---> Return `true` to cancel the key event.
---@field KEY_PRESS Event.KeyPress | Event.KeyPress.func
---This event runs when a key is pressed, held, or released.
---> ```lua
---> (callback) function(key: integer, state: integer, modifiers: integer)
--->   -> cancel: boolean?
---> ```
---> ***
---> A callback that is given the id of a key being pressed, the press state of the key, and the active modifier keys as
---> a bitmask.
--->
---> Return `true` to cancel the key event.
---@field key_press Event.KeyPress | Event.KeyPress.func
---This event runs when the mouse is moved.
---> ```lua
---> (callback) function(x: integer, y: integer)
--->   -> cancel: boolean?
---> ```
---> ***
---> A callback that is given the x and y change of the mouse's position in pixels.
--->
---> Return `true` to deny the change.
---@field MOUSE_MOVE Event.MouseMove | Event.MouseMove.func
---This event runs when the mouse is moved.
---> ```lua
---> (callback) function(x: integer, y: integer)
--->   -> cancel: boolean?
---> ```
---> ***
---> A callback that is given the x and y change of the mouse's position in pixels.
--->
---> Return `true` to deny the change.
---@field mouse_move Event.MouseMove | Event.MouseMove.func
---This event runs when the mouse is pressed or released.
---> ```lua
---> (callback) function(button: integer, state: integer, modifiers: integer)
--->   -> cancel: boolean?
---> ```
---> ***
---> A callback that is given the id of a mouse button being pressed, the press state of the button, and the active
---> modifier keys as a bitmask.
--->
---> Return `true` to deny the change.
---@field MOUSE_PRESS Event.MousePress | Event.MousePress.func
---This event runs when the mouse is pressed or released.
---> ```lua
---> (callback) function(button: integer, state: integer, modifiers: integer)
--->   -> cancel: boolean?
---> ```
---> ***
---> A callback that is given the id of a mouse button being pressed, the press state of the button, and the active
---> modifier keys as a bitmask.
--->
---> Return `true` to deny the change.
---@field mouse_press Event.MousePress | Event.MousePress.func
---This event runs when the mouse wheel is scrolled.
---> ```lua
---> (callback) function(dir: number)
--->   -> cancel: boolean?
---> ```
---> ***
---> A callback that is given the amount the scroll wheel has scrolled. This is *usually* `1` or `-1` but can be more or
---> less due to certain factors.
--->
---> Return `true` to deny the scroll.
---@field MOUSE_SCROLL Event.MouseScroll | Event.MouseScroll.func
---This event runs when the mouse wheel is scrolled.
---> ```lua
---> (callback) function(dir: number)
--->   -> cancel: boolean?
---> ```
---> ***
---> A callback that is given the amount the scroll wheel has scrolled. This is *usually* `1` or `-1` but can be more or
---> less due to certain factors.
--->
---> Return `true` to deny the scroll.
---@field mouse_scroll Event.MouseScroll | Event.MouseScroll.func
---This event runs when a sound is played.
---> ```lua
---> (callback) function(id: string, pos: Vector3, volume: number, pitch: number, loop: boolean, category: string, path: string)
--->   -> cancel: boolean?
---> ```
---> ***
---> A callback that is given the id of a sound, its position, volume, pitch, whether it loops, its category, and the
---> path of the sound file it played.
--->
---> If `path` is `nil`, the sound was played by a Figura avatar.
--->
---> Return `true` to deny the sound from playing.
---@field ON_PLAY_SOUND Event.OnPlaySound | Event.OnPlaySound.func
---This event runs when a sound is played.
---> ```lua
---> (callback) function(id: string, pos: Vector3, volume: number, pitch: number, loop: boolean, category: string, path: string)
--->   -> cancel: boolean?
---> ```
---> ***
---> A callback that is given the id of a sound, its position, volume, pitch, whether it loops, its category, and the
---> path of the sound file it played.
--->
---> If `path` is `nil`, the sound was played by a Figura avatar.
--->
---> Return `true` to deny the sound from playing.
---@field on_play_sound Event.OnPlaySound | Event.OnPlaySound.func
---This event runs after the avatar has fully rendered.  
---`:partToWorldMatrix()` is fully updated in this event.
---
---By the time this event runs, the avatar will have to wait until the next frame to apply modifications visually.
---> ```lua
---> (callback) function(delta: number, ctx: string, matrix: Matrix4)
---> ```
---> ***
---> A callback that is given the current tick delta, the context that the avatar is rendering in, and the matrix used
---> to render the avatar.
---@field POST_RENDER Event.Render | Event.Render.func
---This event runs after the avatar has fully rendered.  
---`:partToWorldMatrix()` is fully updated in this event.
---
---By the time this event runs, the avatar will have to wait until the next frame to apply modifications visually.
---> ```lua
---> (callback) function(delta: number, ctx: string, matrix: Matrix4)
---> ```
---> ***
---> A callback that is given the current tick delta, the context that the avatar is rendering in, and the matrix used
---> to render the avatar.
---@field post_render Event.Render | Event.Render.func
---This event runs after the world has fully rendered.  
---This event always runs, even if the avatar is not visible.
---
---By the time this event runs, "World" parts will have to wait until the next frame to apply modifications visually.
---> ```lua
---> (callback) function(delta: number)
---> ```
---> ***
---> A callback that is given the current tick delta.
---@field POST_WORLD_RENDER Event.WorldRender | Event.WorldRender.func
---This event runs after the world has fully rendered.  
---This event always runs, even if the avatar is not visible.
---
---By the time this event runs, "World" parts will have to wait until the next frame to apply modifications visually.
---> ```lua
---> (callback) function(delta: number)
---> ```
---> ***
---> A callback that is given the current tick delta.
---@field post_world_render Event.WorldRender | Event.WorldRender.func
---This event runs before the avatar is rendered.
---> ```lua
---> (callback) function(delta: number, ctx: string, matrix: Matrix4)
---> ```
---> ***
---> A callback that is given the current tick delta, the context that the avatar is rendering in, and the matrix used
---> to render the avatar.
---@field RENDER Event.Render | Event.Render.func
---This event runs before the avatar is rendered.
---> ```lua
---> (callback) function(delta: number, ctx: string, matrix: Matrix4)
---> ```
---> ***
---> A callback that is given the current tick delta, the context that the avatar is rendering in, and the matrix used
---> to render the avatar.
---@field render Event.Render | Event.Render.func
---This event runs when the client reloads its resources. (Such as with <kbd>F3+T</kbd>.)
---> ```lua
---> (callback) function()
---> ```
---> ***
---> A callback that does nothing special, it just runs whenever the event it is attached to runs.
---@field RESOURCE_RELOAD Event.Generic | Event.Generic.func
---This event runs when the client reloads its resources. (Such as with <kbd>F3+T</kbd>.)
---> ```lua
---> (callback) function()
---> ```
---> ***
---> A callback that does nothing special, it just runs whenever the event it is attached to runs.
---@field resource_reload Event.Generic | Event.Generic.func
---This event runs before each of the avatar owner's skull blocks are rendered.
---> ```lua
---> (callback) function(delta: number, block?: BlockState, item?: ItemStack, entity?: Entity, ctx: string)
---> ```
---> ***
---> A callback that is given the current tick delta, a block state if the skull is placed, an item stack if the skull
---> is being held, or an entity if the skull is being worn, and the context the skull is being rendered in.
---@field SKULL_RENDER Event.SkullRender | Event.SkullRender.func
---This event runs before each of the avatar owner's skull blocks are rendered.
---> ```lua
---> (callback) function(delta: number, block?: BlockState, item?: ItemStack, entity?: Entity, ctx: string)
---> ```
---> ***
---> A callback that is given the current tick delta, a block state if the skull is placed, an item stack if the skull
---> is being held, or an entity if the skull is being worn, and the context the skull is being rendered in.
---@field skull_render Event.SkullRender | Event.SkullRender.func
---This event runs every tick while the player entity is loaded.
---> ```lua
---> (callback) function()
---> ```
---> ***
---> A callback that does nothing special, it just runs whenever the event it is attached to runs.
---@field TICK Event.Generic | Event.Generic.func
---This event runs every tick while the player entity is loaded.
---> ```lua
---> (callback) function()
---> ```
---> ***
---> A callback that does nothing special, it just runs whenever the event it is attached to runs.
---@field tick Event.Generic | Event.Generic.func
---This event runs every frame for every trident the avatar's owner has thrown.
---> ```lua
---> (callback) function(delta: number, entity: Entity)
--->   -> hide: boolean?
---> ```
---> ***
---> A callback that is given the current tick delta and the trident that is being rendered.
--->
---> Return `true` to completely hide the current trident.
---@*error Missing doc string.
---@field TRIDENT_RENDER Event.TridentRender | Event.TridentRender.func
---This event runs every frame for every trident the avatar's owner has thrown.
---> ```lua
---> (callback) function(delta: number, entity: Entity)
--->   -> hide: boolean?
---> ```
---> ***
---> A callback that is given the current tick delta and the trident that is being rendered.
--->
---> Return `true` to completely hide the current trident.
---@*error Missing doc string.
---@field trident_render Event.TridentRender | Event.TridentRender.func
---This event runs twice every 4 ticks while an item is being used.
---> ```lua
---> (callback) function(item: ItemStack, anim: ItemStack.useAction, ptc_count: integer)
---> ```
---> ***
---> A callback that is given the item being used, the animation the item is doing, and the amount of particles this
---> action will create.
---@field USE_ITEM Event.UseItem | Event.UseItem.func
---This event runs twice every 4 ticks while an item is being used.
---> ```lua
---> (callback) function(item: ItemStack, anim: ItemStack.useAction, ptc_count: integer)
---> ```
---> ***
---> A callback that is given the item being used, the animation the item is doing, and the amount of particles this
---> action will create.
---@field use_item Event.UseItem | Event.UseItem.func
---This event runs before the world is rendered.
---> ```lua
---> (callback) function(delta: number)
---> ```
---> ***
---> A callback that is given the current tick delta.
---@field WORLD_RENDER Event.WorldRender | Event.WorldRender.func
---This event runs before the world is rendered.
---> ```lua
---> (callback) function(delta: number)
---> ```
---> ***
---> A callback that is given the current tick delta.
---@field world_render Event.WorldRender | Event.WorldRender.func
---This event runs every tick.
---> ```lua
---> (callback) function()
---> ```
---> ***
---> A callback that does nothing special, it just runs whenever the event it is attached to runs.
---@field WORLD_TICK Event.Generic | Event.Generic.func
---This event runs every tick.
---> ```lua
---> (callback) function()
---> ```
---> ***
---> A callback that does nothing special, it just runs whenever the event it is attached to runs.
---@field world_tick Event.Generic | Event.Generic.func
local EventsAPI


---Gets a table of all available events.
---@return {[string]: Event}
---@nodiscard
function EventsAPI:getEvents() end
