EventsAPI

A global API that contains all of the figura Events
Accessed using the name "events"

EventsAPI.getEvents

Returns a table with all events types
overload 1:
events:getEvents()
Method Property Fluent Description Representation
Return Value a table

EventsAPI.ENTITY_INIT

The ENTITY_INIT event is run once this avatar's entity exists
field signature:
ENTITY_INIT
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.TICK

The TICK event is run every tick in-game if this avatar's entity exists
field signature:
TICK
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.WORLD_TICK

The WORLD_TICK event is run every in-game tick
field signature:
WORLD_TICK
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.RENDER

The RENDER event is run every frame, before the avatar is rendered
Takes a parameter delta,
which is a number from 0 to 1 indicating the proportion of the way the game is between ticks
A second parameter,
giving out context of the current RenderMode, with is a string with the name of the source of this render event
And a third paramenter,
being the source matrix used to render the Avatar
field signature:
RENDER
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.POST_RENDER

The POST_RENDER event runs every frame after the avatar is rendered
Takes a parameter delta,
which is a number from 0 to 1 indicating the proportion of the way the game is between ticks
A second parameter,
giving out context of the current RenderMode, with is a string with the name of the source of this render event
And a third parameter,
being the source matrix used to render the Avatar
field signature:
POST_RENDER
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.WORLD_RENDER

The WORLD_RENDER event is run every frame before the world is rendered
Always runs when a world is visible,
even when the avatar itself is not, so this runs even in first person
Takes a parameter delta,
which is a number from 0 to 1 indicating the proportion of the way the game is between ticks
field signature:
WORLD_RENDER
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.POST_WORLD_RENDER

The POST_WORLD_RENDER event runs every frame after the world is rendered
Always runs when a world is visible,
even when the avatar itself is not, so this runs even in first person
Takes a parameter delta,
which is a number from 0 to 1 indicating the proportion of the way the game is between ticks
field signature:
POST_WORLD_RENDER
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.CHAT_SEND_MESSAGE

The CHAT_SEND_MESSAGE event is run every time you send a message in chat
A string parameter is passed in,
which contains the message that was sent
The return value is chained to the next events of the same type,
whereas NIL cancels the message from being sent and any other value will modify the sent message (if allowed in the settings)
field signature:
CHAT_SEND_MESSAGE
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.CHAT_RECEIVE_MESSAGE

The CHAT_RECEIVE_MESSAGE event is run every time a message is received in chat
The first argument is the raw string of the received text
The second argument is a JSON string representation of the received text
If the first return value is not nil,
the message will be replaced with that value
If the first return value is false,
it will suppress adding this message
The second return value is,
optionally, an RGB vector which will be used as the background color for this message
field signature:
CHAT_RECEIVE_MESSAGE
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.SKULL_RENDER

Called on every one of your skull blocks placed in the world
It have 5 arguments,
as listed below:
(number) - the tick delta
(blockstate) - the block,
when rendered from a block
(itemstack) - the item,
when rendered from an item
(entity) - the entity, when rendered from an entity
(string) - the type of the rendering (LEFT_HAND,
HEAD, BLOCK, …)
If the return value is true, the skull will not render
field signature:
SKULL_RENDER
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.MOUSE_SCROLL

The MOUSE_SCROLL event runs every time the mouse is scrolled
Takes a parameter delta,
which is the direction of the scroll
If returned true,
the event cancels its vanilla function
field signature:
MOUSE_SCROLL
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.MOUSE_MOVE

The MOUSE_MOVE event runs every time the mouse is moved around
Takes two parameters,
x and y, which is the difference from the mouse position based on the latest saved position
If returned true,
the event cancels its vanilla function
Note that canceling the vanilla function also cancels saving the last mouse position
field signature:
MOUSE_MOVE
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.MOUSE_PRESS

The MOUSE_PRESS event runs every time a mouse button is pressed
Takes three number parameters,
a "button", which is the number id of the button that was been pressed, the "action", which is the status of the press event (0 for release, 1 for press, 2 for hold), and the "modifier", which is a bitmask number detecting if you have any modifier keys being pressed (like shift or alt, for example)
If returned true, the event cancels its vanilla function
field signature:
MOUSE_PRESS
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.KEY_PRESS

The KEY_PRESS event runs every time a keyboard key is pressed
Takes three number parameters,
a "key", which is the number id of the key that was been pressed, the "action", which is the status of the press event (0 for release, 1 for press, 2 for hold), and the "modifier", which is a bitmask number detecting if you have any modifier keys being pressed (like shift or alt, for example)
If returned true, the event cancels its vanilla function
field signature:
KEY_PRESS
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.CHAR_TYPED

The CHAR_TYPED event runs every time a character is inputted
Takes three parameters,
the resulting "string" after converting the code point, the "modifier", which is a bitmask number detecting if you have any modifier keys being pressed (like shift or alt, for example), and the "codepoint" of the inputted char
field signature:
CHAR_TYPED
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.USE_ITEM

The USE_ITEM event is run every time the entity uses an item
The item,
action and amount of particles this item would produce is given as argument
If returned true,
the event cancels its vanilla function
field signature:
USE_ITEM
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.ARROW_RENDER

The ARROW_RENDER event is run for every arrow entity shot by the Avatar owner
It takes two arguments,
the tick delta, and the arrow entity
Returning "true" stops this arrow from rendering,
including the Arrow parent parts
Requires the "Vanilla Model Change" permission
field signature:
ARROW_RENDER
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.TRIDENT_RENDER

figura.docs.events.trident_render
field signature:
TRIDENT_RENDER
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.ITEM_RENDER

Called on every one of your items that is being rendered
It takes six arguments: the item being rendered,
the rendering mode, the position, rotation, and scale that would be applied to the item, and if it's being rendered in the left hand
Returning a ModelPart parented to Item stops the rendering of this item and will render the returned part instead
field signature:
ITEM_RENDER
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.ON_PLAY_SOUND

Called every time a new sound is played
Takes the following as arguments: the sound's ID,
its world position, volume, pitch, if the sound should loop, the sound's category, and the sound's file path
Return true to prevent this sound from playing
field signature:
ON_PLAY_SOUND
Method Property Fluent Description Representation
Field Type an Event

EventsAPI.RESOURCE_RELOAD

Called every time that the client resources are reloaded, allowing you to re-create or update resource texture references
field signature:
RESOURCE_RELOAD
Method Property Fluent Description Representation
Field Type an Event
a a