Figura Documentation

repository·1.20·Indexed 19 days ago

https://github.com/figuramc/figura

A Minecraft client-side mod for advanced player model customization using Blockbench models and Lua scripting. Supports Fabric, Forge, Quilt, and NeoForge. Features include a Lua API for custom logic, Blockbench animation integration, emissive textures, and a system for sharing custom avatars without server-side installation.

Tokens
3.5K
Snippets
19
Records
25
Agent score
67%

What's inside Figura

  1. Overview of Figura

    1.20

    Figura is a Minecraft Java client mod that allows users to extensively customize their player models. These custom avatars are visible to other players without requiring any server-side modifications.

    Key features include:

    • Blockbench Integration: Full support for models and animations created in Blockbench.
    • Lua API: An optional scripting API to add custom logic and behavior to avatars.
    • Permission System: Robust controls to manage visibility (e.g., handling invisible or small players).
    • Cross-Platform Support: Available for Fabric, Forge, Quilt, and NeoForge.
  2. Use Pings to sync Lua functions across players

    1.20

    Pings are Lua functions executed for everyone running your avatar's script. They are sent from the host player and are used to synchronize actions like keypresses or menu selections.

    Note: Pings are rate-limited and have constraints on content size.

    To define a ping, add it to the pings table. To execute it, call it like a standard Lua function.

    -- Define a ping
    function pings.myPing(arg1, arg2)
      -- code to run on all clients when called
    end
    
    -- Execute the ping
    pings.myPing("Hello", "World")
  3. Add emissive (glowing) textures to your model

    1.20

    To create an emissive texture that glows:

    1. Name the texture file the same as your standard texture, but append _e to the end (e.g., texture_e.png).
    2. In the emissive texture, set any areas you do not want to glow to transparent black (#00000000). This ensures compatibility with shader mods.

    Troubleshooting Shaders: If your emissives do not glow or show bloom with Iris/OptiFine shaders, you can force the correct render type by setting the render type to EYES on your model.

  4. Ensure your avatar is recognized by Figura

    1.20

    If your avatar is in the correct folder but does not appear in the in-game Figura list, ensure that the avatar folder contains a file named avatar.json.

    This file can be completely empty; its presence is simply required for Figura to recognize the folder as a valid avatar.

  5. Play Blockbench animations in Lua

    1.20

    To trigger an animation created in Blockbench, use the following syntax in your Lua script:

    animations.modelName.animationName:play()
    • animations: The global table containing all animations.
    • modelName: The name of the model containing the animation.
    • animationName: The specific name of the animation you wish to play.
    animations.myModel.walk:play()
  6. Hide vanilla Minecraft models using Lua

    1.20

    You can hide parts of the default Minecraft player model by using the vanilla_model global in your Lua script. Place these commands at the top of your script:

    • Hide everything (player, armor, elytra, held items): vanilla_model.ALL:setVisible(false)
    • Hide only the player: vanilla_model.PLAYER:setVisible(false)
    • Hide only armor: vanilla_model.ARMOR:setVisible(false)

    For other specific parts, consult the in-game documentation.

    -- To hide everything
    vanilla_model.ALL:setVisible(false)
    
    -- To hide only the player
    vanilla_model.PLAYER:setVisible(false)
    
    -- To hide only armor
    vanilla_model.ARMOR:setVisible(false)
  7. Understand the structure of the `debug_data.json` report

    1.20

    The exported debug_data.json file contains several key sections that describe the mod's state:

    • meta: General mod information including version, local UUID, directory paths (Figura, Avatar, Cache, Resources), and backend connection status.
    • config: The current values of all Figura configuration settings.
    • permissions: A detailed breakdown of all permission packs, including standard and custom permissions for each category.
    • avatars: A tree structure representing the paths of all locally available avatars.
    • avatar: (Only present if an avatar is currently loaded) Detailed metadata for the active avatar, including:
      • meta: Version, color, authors, name, file size, and whether it has Lua runtime, a renderer, or NBT data.
      • instructions: Complexity metrics and the specific instruction strings used for entity initialization, rendering, and ticking.
      • sounds: A list of custom sound names.
      • animations: A list of animation paths (format: modelName/animationName).
      • sizes: A breakdown of the NBT data sizes for models, animations, textures, scripts, and sounds.
  8. Reference: /badge command arguments and subcommands

    1.20

    The /badge command supports the following subcommands and arguments:

    Subcommand/ArgumentTypeDescription
    setLiteralSets a specific pride badge.
    clearLiteralRemoves all currently set pride badges.
    badgeStringThe name of the pride badge to set (case-insensitive).

    Available badge names include (case-insensitive during input, but stored as uppercase): AGENDER, AROACE, AROMANTIC, ASEXUAL, BIGENDER, BISEXUAL, DEMIBOY, DEMIGENDER, DEMIGIRL, DEMIROMANTIC, DEMISEXUAL, DISABILITY, FINSEXUAL, GAYMEN, GENDERFAE, GENDERFLUID, GENDERQUEER, INTERSEX, LESBIAN, NONBINARY, PANSEXUAL, PLURAL, POLYSEXUAL, PRIDE, TRANSGENDER.

  9. Export a texture using `/export texture`

    1.20

    Use the /export texture command to save a specific texture used by your avatar as a .png file. The file will be saved in your Figura directory.

    Usage Patterns:

    • /export texture <texture name>: Exports the specified texture with the default filename exported_texture.png.
    • /export texture <texture name> <name>: Exports the specified texture with a custom filename <name>.png (using a greedy string for the name).

    Arguments:

    • texture name: The name of the texture to export (single word).
    • name: The desired filename for the exported texture (greedy string).

    Feedback:

    • Success: command.export_texture.success
    • Error: command.export_texture.error
    # Export a texture named 'my_skin' as 'exported_texture.png'
    /export texture my_skin
    
    # Export a texture named 'my_skin' as 'custom_name.png'
    /export texture my_skin custom_name
  10. Run Lua code via the `/run` command

    1.20

    The /run <code command allows you to execute arbitrary Lua code directly from the Minecraft chat. This is useful for testing snippets or triggering specific Lua functions defined in your avatar's scripts.

    Usage:

    • /run <code

    Details:

    • The <code argument uses a greedy string, meaning you can include spaces and special characters in your Lua snippet.
    • The command attempts to load the provided string as a Lua chunk named "runCommand" and executes it.
    • If the execution fails due to a Lua error or a stack overflow, the error is printed to the user via the Figura Lua error printer.
    /run <lua_code_here>