Skip to main content

Client

A global API used to interact with the current Minecraft client

warning

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:

TypeDescription
ViewerAPI-

Example:

client:getViewer()

Versions

getVersion()

Returns the Minecraft version of your client

getVersion()

Returns:

TypeDescription
String-

Example:

client:getVersion()

getVersionName()

Returns the extended name of the Minecraft version of your client

getVersionName()

Returns:

TypeDescription
String-

Example:

client:getVersionName()

getJavaVersion()

Returns your current Java version you're playing Minecraft with

getJavaVersion()

Returns:

TypeDescription
String-

Example:

client:getJavaVersion()

isSnapshot()

Returns if the client is running a snapshot or full release version

isSnapshot()

Returns:

TypeDescription
Boolean-

Example:

client:isSnapshot()

getFiguraVersion()

Gets the client Figura version

getFiguraVersion()

Returns:

TypeDescription
String-

Example:

client:getFiguraVersion()

compareVersions()

Compares two versions if they are less than (-1), equals (0) or greater than (1)

compareVersions(version1, version2)

Parameters:

NameTypeDescriptionDefault
version1String--
version2String--

Returns:

TypeDescription
Integer-

Example:

client:compareVersions("0.1.0", "0.1.3")

isModLoaded()

Checks if the client has loaded the given mod ID

isModLoaded(modID)

Parameters:

NameTypeDescriptionDefault
modIDString--

Returns:

TypeDescription
Boolean-

Example:

client:isModLoaded("origins")

hasShaderPackMod()

Checks if the client has a Shader Pack mod installed

hasShaderPackMod()

Returns:

TypeDescription
Boolean-

Example:

client:hasShaderPackMod()

hasShaderPack()

Checks if the client is currently using a Shader Pack

hasShaderPack()

Returns:

TypeDescription
Boolean-

Example:

client:hasShaderPack()

getShaderPackName()

Returns a string with the current shader pack name, empty if none is being used.

getShaderPackName()

Returns:

TypeDescription
String-

Example:

client:getShaderPackName()

getClientBrand()

Returns the "version type" of your client, usually the client modloader brand

getClientBrand()

Returns:

TypeDescription
String-

Example:

client:getClientBrand()

getServerBrand()

Returns the type of server you're on

In singleplayer, this is "Integrated"

getServerBrand()

Returns:

TypeDescription
String-

Example:

client:getServerBrand()

Client Camera

getCameraPos()

Returns the position of the viewer's camera

getCameraPos()

Returns:

TypeDescription
Vector3-

Example:

client:getCameraPos()

getCameraRot()

Returns the rotation of the viewer's camera

getCameraRot()

Returns:

TypeDescription
Vector3-

Example:

client:getCameraRot()

getCameraDir()

Returns a unit vector pointing in the direction that the camera is facing

getCameraDir()

Returns:

TypeDescription
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:

TypeDescription
EntityAPI-

Example:

client:getCameraEntity()

getFOV()

Returns the current FOV option of the client, not including additional effects such as speed or sprinting

getFOV()

Returns:

TypeDescription
Number-

Example:

client:getFOV()

getWindowSize()

Returns the size of the Minecraft window in pixels, as (width, height)

getWindowSize()

Returns:

TypeDescription
Vector2-

Example:

client:getWindowSize()

getScaledWindowSize()

Returns the size of the window in Minecraft's internal GUI units

getScaledWindowSize()

Returns:

TypeDescription
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:

TypeDescription
Number-

Example:

client:getGuiScale()

getMousePos()

Returns the position of the mouse in pixels, relative to the top-left corner

getMousePos()

Returns:

TypeDescription
Vector2-

Example:

client:getMousePos()

Client State

isPaused()

Returns true if the client is paused

isPaused()

Returns:

TypeDescription
Boolean-

Example:

client:isPaused()

isHudEnabled()

Returns true if the hud is enabled (F1 disables the HUD)

isHudEnabled()

Returns:

TypeDescription
Boolean-

Example:

client:isHudEnabled()

isDebugOverlayEnabled()

Returns true if the F3 screen is currently open

isDebugOverlayEnabled()

Returns:

TypeDescription
Boolean-

Example:

client:isDebugOverlayEnabled()

getActiveResourcePacks()

Returns a table with the active resource pack names

getActiveResourcePacks()

Returns:

TypeDescription
Table-

Example:

client:getActiveResourcePacks()

hasResource()

Checks if the specific resource exists within the client resources

hasResource(path)

Parameters:

NameTypeDescriptionDefault
pathString--

Returns:

TypeDescription
Boolean-

Example:

client:hasResource()

getActiveLang()

Returns a string representation of the current game language

getActiveLang()

Returns:

TypeDescription
String-

Example:

client:getActiveLang()

isWindowFocused()

Returns true if the Minecraft window is currently focused

isWindowFocused()

Returns:

TypeDescription
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:

TypeDescription
String-

Example:

client:getCurrentEffect()

Stats

getEntityCount()

Returns the number of currently loaded entities

getEntityCount()

Returns:

TypeDescription
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:

TypeDescription
String-

Example:

client:getEntityStatistics()

getServerData()

Returns a table with information on the currently connected server (also for singleplayer worlds)

getServerData()

Returns:

TypeDescription
Table-

Example:

client:getServerData()

getDate()

Returns a table with information about the client's current time

getDate()

Returns:

TypeDescription
Table-

Example:

client:getDate()

getSystemTime()

Returns the current system time in milliseconds

getSystemTime()

Returns:

TypeDescription
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:

TypeDescription
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:

TypeDescription
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:

TypeDescription
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:

TypeDescription
String-

Example:

client:getSoundStatistics()

getMaxMemory()

Returns the maximum amount of memory that Minecraft will try to use

getMaxMemory()

Returns:

TypeDescription
Integer-

Example:

client:getMaxMemory()

getAllocatedMemory()

Returns the maximum amount of memory that Minecraft could possibly use

getAllocatedMemory()

Returns:

TypeDescription
Integer-

Example:

client:getAllocatedMemory()

getUsedMemory()

Returns the number of bytes of memory Minecraft is currently using

getUsedMemory()

Returns:

TypeDescription
Integer-

Example:

client:getUsedMemory()

getChunkStatistics()

Returns a string containing information about the player's chunk

This string appears in the F3 menu

getChunkStatistics()

Returns:

TypeDescription
String-

Example:

client:getChunkStatistics()

getParticleCount()

Returns the number of currently loaded particles

getParticleCount()

Returns:

TypeDescription
String-

Example:

client:getParticleCount()

Misc

getActionbar()

Returns the current actionbar text, or nil if the action bar isn't visible

getActionbar()

Returns:

TypeDescription
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:

NameTypeDescriptionDefault
pathString--

Returns:

TypeDescription
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:

NameTypeDescriptionDefault
enumNameString--

Returns:

TypeDescription
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:

NameTypeDescriptionDefault
registryNameString--

Returns:

TypeDescription
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:

TypeDescription
Table-

Example:

client:getScoreboard()

getSubtitle()

Returns the current subtitle text, or nil if the title or subtitle isn't visible

getSubtitle()

Returns:

TypeDescription
String-

Example:

client:getSubtitle()

getTabList()

Returns a table with the text shown in the tablist

getTabList()

Returns:

TypeDescription
Table-

Example:

client:getTabList()

getTextDimensions()

Returns the width and height of the given text, wrapping lines and trimming to a max width

getTextDimensions(text)

Parameters:

NameTypeDescriptionDefault
textString--

Returns:

TypeDescription
Vector2-

Example:

client:getTextDimensions("Example text", 40, true)

getTextHeight()

Returns the height of the given text in pixels

getTextHeight(text)

Parameters:

NameTypeDescriptionDefault
textString--

Returns:

TypeDescription
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:

NameTypeDescriptionDefault
textString--

Returns:

TypeDescription
Integer-

Example:

client:getTextWidth("Example text")

getTitle()

Returns the current title text, or nil if the title isn't visible

getTitle()

Returns:

TypeDescription
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

getTranslatedString(text)

Parameters:

NameTypeDescriptionDefault
textString--

Returns:

TypeDescription
String-

Example:

client.getTranslatedString("figura.gui.wardrobe.drop_files")

generateUUID()

Generates a random UUID

generateUUID()

Returns:

TypeDescription
Integeruuid[1]
Integeruuid[2]
Integeruuid[3]
Integeruuid[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:

NameTypeDescriptionDefault
aInteger--
bInteger--
cInteger--
dInteger--

Returns:

TypeDescription
String-

Example:

client:intUUIDToString()

listAtlases()

Returns a list of all registered atlases paths

listAtlases()

Returns:

TypeDescription
Table-

Example:

client:listAtlases()

uuidToIntArray()

Converts a string UUID into its int array representation, returning four seperate integers

uuidToIntArray(uuid)

Parameters:

NameTypeDescriptionDefault
uuidString--

Returns:

TypeDescription
Integeruuid[1]
Integeruuid[2]
Integeruuid[3]
Integeruuid[4]

Example:

local a, b, c, d = client:uuidToIntArray("5003b2ce-7a8d-4c56-8b91-ec705985fe08")