Client
A global API used to interact with the current Minecraft client
This page is a WIP. It contains all the information in Figura's documentation but we're working on adding more helpful descriptions.
Most of its functions return things that can be found in the F3 menu
getViewer()
Returns the player entity from the running client
getViewer()
Returns:
Type | Description |
---|---|
ViewerAPI | - |
Example:
client:getViewer()
Versions
getVersion()
Returns the Minecraft version of your client
getVersion()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getVersion()
getVersionName()
Returns the extended name of the Minecraft version of your client
getVersionName()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getVersionName()
getJavaVersion()
Returns your current Java version you're playing Minecraft with
getJavaVersion()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getJavaVersion()
isSnapshot()
Returns if the client is running a snapshot or full release version
isSnapshot()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
client:isSnapshot()
getFiguraVersion()
Gets the client Figura version
getFiguraVersion()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getFiguraVersion()
compareVersions()
Compares two versions if they are less than (-1), equals (0) or greater than (1)
compareVersions(version1, version2)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
version1 | String | - | - |
version2 | String | - | - |
Returns:
Type | Description |
---|---|
Integer | - |
Example:
client:compareVersions("0.1.0", "0.1.3")
isModLoaded()
Checks if the client has loaded the given mod ID
isModLoaded(modID)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
modID | String | - | - |
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
client:isModLoaded("origins")
hasShaderPackMod()
Checks if the client has a Shader Pack mod installed
hasShaderPackMod()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
client:hasShaderPackMod()
hasShaderPack()
Checks if the client is currently using a Shader Pack
hasShaderPack()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
client:hasShaderPack()
getShaderPackName()
Returns a string with the current shader pack name, empty if none is being used.
getShaderPackName()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getShaderPackName()
getClientBrand()
Returns the "version type" of your client, usually the client modloader brand
getClientBrand()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getClientBrand()
getServerBrand()
Returns the type of server you're on
In singleplayer, this is "Integrated"
getServerBrand()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getServerBrand()
Client Camera
getCameraPos()
Returns the position of the viewer's camera
getCameraPos()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
client:getCameraPos()
getCameraRot()
Returns the rotation of the viewer's camera
getCameraRot()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
client:getCameraRot()
getCameraDir()
Returns a unit vector pointing in the direction that the camera is facing
getCameraDir()
Returns:
Type | Description |
---|---|
Vector3 | - |
Example:
client:getCameraDir()
getCameraEntity()
Returns the entity the camera is currently targeting, so returns the entity you are currently spectating, including yourself
getCameraEntity()
Returns:
Type | Description |
---|---|
EntityAPI | - |
Example:
client:getCameraEntity()
getFOV()
Returns the current FOV option of the client, not including additional effects such as speed or sprinting
getFOV()
Returns:
Type | Description |
---|---|
Number | - |
Example:
client:getFOV()
getWindowSize()
Returns the size of the Minecraft window in pixels, as (width, height)
getWindowSize()
Returns:
Type | Description |
---|---|
Vector2 | - |
Example:
client:getWindowSize()
getScaledWindowSize()
Returns the size of the window in Minecraft's internal GUI units
getScaledWindowSize()
Returns:
Type | Description |
---|---|
Vector2 | - |
Example:
client:getScaledWindowSize()
getGuiScale()
Returns the current value of your Gui Scale setting
If you use auto, then it gets the actual current scale
getGuiScale()
Returns:
Type | Description |
---|---|
Number | - |
Example:
client:getGuiScale()
getMousePos()
Returns the position of the mouse in pixels, relative to the top-left corner
getMousePos()
Returns:
Type | Description |
---|---|
Vector2 | - |
Example:
client:getMousePos()
Client State
isPaused()
Returns true if the client is paused
isPaused()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
client:isPaused()
isHudEnabled()
Returns true if the hud is enabled (F1 disables the HUD)
isHudEnabled()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
client:isHudEnabled()
isDebugOverlayEnabled()
Returns true if the F3 screen is currently open
isDebugOverlayEnabled()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
client:isDebugOverlayEnabled()
getActiveResourcePacks()
Returns a table with the active resource pack names
getActiveResourcePacks()
Returns:
Type | Description |
---|---|
Table | - |
Example:
client:getActiveResourcePacks()
hasResource()
Checks if the specific resource exists within the client resources
hasResource(path)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path | String | - | - |
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
client:hasResource()
getActiveLang()
Returns a string representation of the current game language
getActiveLang()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getActiveLang()
isWindowFocused()
Returns true if the Minecraft window is currently focused
isWindowFocused()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
client:isWindowFocused()
getCurrentEffect()
Returns the path to the currently applied shader, used when spectating an entity that has different vision than normal
Normally returns nil
getCurrentEffect()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getCurrentEffect()
Stats
getEntityCount()
Returns the number of currently loaded entities
getEntityCount()
Returns:
Type | Description |
---|---|
Integer | - |
Example:
client:getEntityCount()
getEntityStatistics()
Returns a string containing information about the loaded entities on the client
This string appears in the F3 menu
getEntityStatistics()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getEntityStatistics()
getServerData()
Returns a table with information on the currently connected server (also for singleplayer worlds)
getServerData()
Returns:
Type | Description |
---|---|
Table | - |
Example:
client:getServerData()
getDate()
Returns a table with information about the client's current time
getDate()
Returns:
Type | Description |
---|---|
Table | - |
Example:
client:getDate()
getSystemTime()
Returns the current system time in milliseconds
getSystemTime()
Returns:
Type | Description |
---|---|
Integer | - |
Example:
client:getSystemTime()
getFPS()
Gets the FPS of the client
Returns 0 if the fps counter isn't ready yet (or if your PC is just that bad)
getFPS()
Returns:
Type | Description |
---|---|
Integer | - |
Example:
client:getFPS()
getFPSString()
Gets the FPS string of the client, displayed in the F3 menu
Contains info on the fps, the fps limit, vsync, cloud types, and biome blend radius
getFPSString()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getFPSString()
getFrameTime()
Returns the current fraction between the last tick and the next tick
This is the value used as "delta" in the RENDER event
getFrameTime()
Returns:
Type | Description |
---|---|
Number | - |
Example:
client:getFrameTime()
getSoundStatistics()
Returns a string containing information about the currently playing sounds on the client
This string appears in the F3 menu
getSoundStatistics()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getSoundStatistics()
getMaxMemory()
Returns the maximum amount of memory that Minecraft will try to use
getMaxMemory()
Returns:
Type | Description |
---|---|
Integer | - |
Example:
client:getMaxMemory()
getAllocatedMemory()
Returns the maximum amount of memory that Minecraft could possibly use
getAllocatedMemory()
Returns:
Type | Description |
---|---|
Integer | - |
Example:
client:getAllocatedMemory()
getUsedMemory()
Returns the number of bytes of memory Minecraft is currently using
getUsedMemory()
Returns:
Type | Description |
---|---|
Integer | - |
Example:
client:getUsedMemory()
getChunkStatistics()
Returns a string containing information about the player's chunk
This string appears in the F3 menu
getChunkStatistics()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getChunkStatistics()
getParticleCount()
Returns the number of currently loaded particles
getParticleCount()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getParticleCount()
Misc
getActionbar()
Returns the current actionbar text, or nil if the action bar isn't visible
getActionbar()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getActionbar()
getAtlas()
Returns a TextureAtlasAPI object with information about the given atlas
Returns nil if the atlas was not found
getAtlas(path)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path | String | - | - |
Returns:
Type | Description |
---|---|
TextureAtlas | - |
Example:
client:getAtlas()
getEnum()
Return an array containing the entries in the given enum
Enums can be found in /figura docs enums
getEnum(enumName)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
enumName | String | - | - |
Returns:
Type | Description |
---|---|
Table | - |
Example:
client:getEnum("ParentTypes")
getRegistry()
Returns a list of all values in the specified registry
See the registries
enum for a list of valid registries
getRegistry(registryName)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
registryName | String | - | - |
Returns:
Type | Description |
---|---|
Table | - |
Example:
for _, variant in ipairs(client:getRegistry("frog_variant")) do
print(variant)
end
getScoreboard()
Returns data about the current scoreboard(s). Multiple scoreboards can be visible at the same time (sidebar, team sidebar, list, and below name), so each scoreboard is grouped by its display location
getScoreboard()
Returns:
Type | Description |
---|---|
Table | - |
Example:
client:getScoreboard()
getSubtitle()
Returns the current subtitle text, or nil if the title or subtitle isn't visible
getSubtitle()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getSubtitle()
getTabList()
Returns a table with the text shown in the tablist
getTabList()
Returns:
Type | Description |
---|---|
Table | - |
Example:
client:getTabList()
getTextDimensions()
Returns the width and height of the given text, wrapping lines and trimming to a max width
- Overload 1
- Overload 2
Example:
client:getTextDimensions("Example text", 40, true)
getTextHeight()
Returns the height of the given text in pixels
getTextHeight(text)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text | String | - | - |
Returns:
Type | Description |
---|---|
Integer | - |
Example:
client:getTextHeight("Example text")
getTextWidth()
Returns the width of the given text in pixels
In case of multiple lines, return the largest width of all lines
getTextWidth(text)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text | String | - | - |
Returns:
Type | Description |
---|---|
Integer | - |
Example:
client:getTextWidth("Example text")
getTitle()
Returns the current title text, or nil if the title isn't visible
getTitle()
Returns:
Type | Description |
---|---|
String | - |
Example:
client:getTitle()
getTranslatedString()
Returns the translated string of the given key
Translation is done using the current client language
Optionally takes a single argument, or a list with all arguments, that will populate the translation
- Overload 1
- Overload 2
Example:
client.getTranslatedString("figura.gui.wardrobe.drop_files")
generateUUID()
Generates a random UUID
generateUUID()
Returns:
Type | Description |
---|---|
Integer | uuid[1] |
Integer | uuid[2] |
Integer | uuid[3] |
Integer | uuid[4] |
Example:
local a, b, c, d = client:generateUUID()
intUUIDToString()
Converts an int array UUID (as 4 separated arguments) into its hexadecimal string representation
intUUIDToString(a, b, c, d)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
a | Integer | - | - |
b | Integer | - | - |
c | Integer | - | - |
d | Integer | - | - |
Returns:
Type | Description |
---|---|
String | - |
Example:
client:intUUIDToString()
listAtlases()
Returns a list of all registered atlases paths
listAtlases()
Returns:
Type | Description |
---|---|
Table | - |
Example:
client:listAtlases()
uuidToIntArray()
Converts a string UUID into its int array representation, returning four seperate integers
uuidToIntArray(uuid)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uuid | String | - | - |
Returns:
Type | Description |
---|---|
Integer | uuid[1] |
Integer | uuid[2] |
Integer | uuid[3] |
Integer | uuid[4] |
Example:
local a, b, c, d = client:uuidToIntArray("5003b2ce-7a8d-4c56-8b91-ec705985fe08")