models

The global instance of the Avatar Models and its subtypes
field signature:
models
Method Property Fluent Description Representation
Field Type a ModelPart

ModelPart.getName

The name of this model part
overload 1:
models:getName()
Method Property Fluent Description Representation
Return Value a String

ModelPart.getParent

Gets the parent part of this part
If this part has no parent,
returns nil
overload 1:
models:getParent()
Method Property Fluent Description Representation
Return Value either a ModelPart or nil

ModelPart.getType

Returns whether this part is a "GROUP", a "CUBE", or a "MESH"
overload 1:
models:getType()
Method Property Fluent Description Representation
Return Value a String

ModelPart.getChildren

Gets the children of this part, stored in a table
overload 1:
models:getChildren()
Method Property Fluent Description Representation
Return Value an array of ModelParts

ModelPart.setColor

Sets the color multiplier for this part for primary and secondary colors
Values are RGB from 0 to 1
overload 1:
models:setColor(color)
Method Property Fluent Description Representation
color accepts a Vector3
Return Value nil
overload 2:
models:setColor(r, g, b)
Method Property Fluent Description Representation
r accepts a Number
g accepts a Number
b accepts a Number
Return Value nil

ModelPart.setScale

Sets the scale factor for this part
Nil values for scale are assumed to be 1
overload 1:
models:setScale(scale)
Method Property Fluent Description Representation
scale accepts a Vector3
Return Value nil
overload 2:
models:setScale(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value nil

ModelPart.newText

Adds a new Text Render Task on this part
overload 1:
models:newText(taskName)
Method Property Fluent Description Representation
taskName accepts a String
Return Value a RenderTask

ModelPart.getTask

Gets the Render Task with the given name from this part
Returns a table with all tasks if a name is not given
overload 1:
models:getTask()
Method Property Fluent Description Representation
Return Value a table mapping a String to a RenderTask
overload 2:
models:getTask(taskName)
Method Property Fluent Description Representation
taskName accepts a String
Return Value a RenderTask

ModelPart.overrideVanillaScale

Returns if this part vanilla scale is being overridden by an animation
overload 1:
models:overrideVanillaScale()
Method Property Fluent Description Representation
Return Value a Boolean

ModelPart.getPositionMatrixRaw

Returns the position matrix for this model part
The Raw version of the function is different in that it doesn't recalculate the matrix before getting it
overload 1:
models:getPositionMatrixRaw()
Method Property Fluent Description Representation
Return Value a Matrix4

ModelPart.setSecondaryRenderType

Sets the current secondary render type of this model part
Nil by default,
meaning the part copies the secondary render type of its parent during rendering
Check the docs enum command for all render types
overload 1:
models:setSecondaryRenderType(renderType)
Method Property Fluent Description Representation
renderType accepts a String
Return Value nil

ModelPart.setPrimaryRenderType

Sets the current primary render type of this model part
Nil by default,
meaning the part copies the primary render type of its parent during rendering
Check the docs enum command for all render types
overload 1:
models:setPrimaryRenderType(renderType)
Method Property Fluent Description Representation
renderType accepts a String
Return Value nil

ModelPart.getSecondaryRenderType

Gets the current secondary render type of this model part
Nil by default,
meaning the part copies the secondary render type of its parent
overload 1:
models:getSecondaryRenderType()
Method Property Fluent Description Representation
Return Value either a RenderTypes or nil

ModelPart.setSecondaryTexture

Sets the secondary texture override of this part
Check the TextureType types in the list docs
If using "resource",
the second parameter should indicate the path to the Minecraft texture you want to use
If using "custom",
the second parameter should indicate a texture object
overload 1:
models:setSecondaryTexture(textureType)
Method Property Fluent Description Representation
textureType accepts a String
Return Value nil
overload 2:
models:setSecondaryTexture(resource, path)
Method Property Fluent Description Representation
resource accepts a String
path accepts a String
Return Value nil
overload 3:
models:setSecondaryTexture(custom, texture)
Method Property Fluent Description Representation
custom accepts a String
texture accepts a Texture
Return Value nil

ModelPart.getPrimaryRenderType

Gets the current primary render type of this model part
Nil by default,
meaning the part copies the primary render type of its parent
overload 1:
models:getPrimaryRenderType()
Method Property Fluent Description Representation
Return Value either a RenderTypes or nil

ModelPart.getVisible

Gets whether or not this model part is visible
The default value is nil,
meaning it copies the visibility of its parent part during rendering
overload 1:
models:getVisible()
Method Property Fluent Description Representation
Return Value either a Boolean or nil

ModelPart.setVisible

Sets this part to be visible or invisible
The default value is nil,
meaning the part copies its visibility from its parent part
overload 1:
models:setVisible(visible)
Method Property Fluent Description Representation
visible accepts a Boolean
Return Value nil

ModelPart.getColor

Returns the average set color from this part, as adding the primary color with the secondary, then dividing them
Values are RGB from 0 to 1
overload 1:
models:getColor()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.getTextures

Returns a table with all textures used by this part
Does not include children textures,
so groups usually will return an empty table
overload 1:
models:getTextures()
Method Property Fluent Description Representation
Return Value a table

ModelPart.getPos

Gets the position of the model part, as an offset from its position in Blockbench
Only changes from {0,
0,0} when you call setPos()
overload 1:
models:getPos()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.getRot

Gets the rotation of the model part, including its rotation in Blockbench
For relative rotation values,
check out the "offset" rot functions
overload 1:
models:getRot()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.getPivot

Gets the pivot point of the model part, including its pivot in Blockbench
For relative values,
check out the "offset" pivot functions
overload 1:
models:getPivot()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.offsetRot

figura.docs.model_part.offset_rot
overload 1:
models:offsetRot(offsetRot)
Method Property Fluent Description Representation
offsetRot accepts a Vector3
Return Value nil
overload 2:
models:offsetRot(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value nil

ModelPart.getAnimPos

Gets the position offset provided by the currently active animation of this model part
overload 1:
models:getAnimPos()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.offsetPivot

figura.docs.model_part.offset_pivot
overload 1:
models:offsetPivot(offsetPivot)
Method Property Fluent Description Representation
offsetPivot accepts a Vector3
Return Value nil
overload 2:
models:offsetPivot(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value nil

ModelPart.getOffsetPivot

Gets the pivot offset of the model part, offset from its pivot in Blockbench
For absolute pivot point values,
check out the non-offset pivot functions
overload 1:
models:getOffsetPivot()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.getAnimScale

Gets the scale multiplier provided by the currently active animation of this model part
overload 1:
models:getAnimScale()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.overrideVanillaPos

Returns if this part vanilla position is being overridden by an animation
overload 1:
models:overrideVanillaPos()
Method Property Fluent Description Representation
Return Value a Boolean

ModelPart.overrideVanillaRot

Returns if this part vanilla rotation is being overridden by an animation
overload 1:
models:overrideVanillaRot()
Method Property Fluent Description Representation
Return Value a Boolean

ModelPart.setMatrix

Sets the given matrix as the position matrix for this model part
The normal matrix is automatically calculated as the inverse transpose of this matrix
Calling this DOES NOT CHANGE the values of position,
rot, or scale in the model part
If you call setPos() or a similar function,
the effects of setMatrix() will be overwritten
overload 1:
models:setMatrix(matrix)
Method Property Fluent Description Representation
matrix accepts a Matrix4
Return Value nil

ModelPart.getAnimRot

Gets the rotation offset provided by the currently active animation of this model part
overload 1:
models:getAnimRot()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.getOffsetRot

Gets the rotation offset of the model part, offset from its rotation in Blockbench
For absolute rotation values,
check out the non-offset rot functions
overload 1:
models:getOffsetRot()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.setPos

Sets the position offset for this part from its Blockbench position
Nil values for position are assumed to be 0
overload 1:
models:setPos(pos)
Method Property Fluent Description Representation
pos accepts a Vector3
Return Value nil
overload 2:
models:setPos(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value nil

ModelPart.setRot

Sets the absolute rotation for this part
Nil values for rotation are assumed to be 0
Angles are given in degrees
For relative rotation values,
check out the "offset" rot functions
overload 1:
models:setRot(rot)
Method Property Fluent Description Representation
rot accepts a Vector3
Return Value nil
overload 2:
models:setRot(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value nil

ModelPart.setPivot

Sets the absolute pivot for this part
Nil values are assumed to be 0
For relative pivot offsets,
check out the "offset" pivot functions
overload 1:
models:setPivot(pivot)
Method Property Fluent Description Representation
pivot accepts a Vector3
Return Value nil
overload 2:
models:setPivot(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value nil

ModelPart.getPositionMatrix

Recalculates the matrix for this model part, based on its current position, rotation, scale, and pivot, then returns this matrix
overload 1:
models:getPositionMatrix()
Method Property Fluent Description Representation
Return Value a Matrix4

ModelPart.getNormalMatrix

Recalculates the normal matrix for this model part, based on its current position, rotation, scale, and pivot, then returns this matrix
overload 1:
models:getNormalMatrix()
Method Property Fluent Description Representation
Return Value a Matrix3

ModelPart.getNormalMatrixRaw

Returns the normal matrix for this model part
The Raw version of the function is different in that it doesn't recalculate the matrix before returning it
overload 1:
models:getNormalMatrixRaw()
Method Property Fluent Description Representation
Return Value a Matrix3

ModelPart.getScale

Gets the scale of the model part, as a multiple of its Blockbench size
Only changes from {1,
1,1} when you call setScale()
overload 1:
models:getScale()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.isChildOf

Checks if this part is a child of the given part
overload 1:
models:isChildOf(part)
Method Property Fluent Description Representation
part accepts a ModelPart
Return Value a Boolean

ModelPart.getUV

Gets the UV of this part
This function is normalized,
meaning it will return values between 0 to 1
overload 1:
models:getUV()
Method Property Fluent Description Representation
Return Value a Vector2

ModelPart.getUVMatrix

Gets the UV matrix of this part
overload 1:
models:getUVMatrix()
Method Property Fluent Description Representation
Return Value a Matrix3

ModelPart.setUVPixels

Sets the UV of this part in pixels
Automatically divides by the results of getTextureSize(),
so you can just input the number of pixels you want the UV to scroll by
Errors if the part has multiple different-sized textures
If this part is a Group,
it will attempt to setUVPixels on its children
overload 1:
models:setUVPixels(uv)
Method Property Fluent Description Representation
uv accepts a Vector2
Return Value nil
overload 2:
models:setUVPixels(u, v)
Method Property Fluent Description Representation
u accepts a Number
v accepts a Number
Return Value nil

ModelPart.setUVMatrix

Sets the UV matrix of this part
This matrix is applied to all UV points during the transform,
with the UVs treated as homogeneous vectors
setUV() and setUVPixels() are just simpler ways of setting this matrix
overload 1:
models:setUVMatrix(matrix)
Method Property Fluent Description Representation
matrix accepts a Matrix3
Return Value nil

ModelPart.setOpacity

Sets the opacity multiplier of this part
Note that opacity settings will only take effect if the part has a suitable Render Type for them,
mainly TRANSLUCENT
Check out modelPart.setPrimaryRenderType() for how to do this
overload 1:
models:setOpacity(opacity)
Method Property Fluent Description Representation
opacity accepts a Number
Return Value nil

ModelPart.partToWorldMatrix

Gets a matrix which transforms a point from this part's position to a world location
Recommended to use this in POST_RENDER,
as by then the matrix is updated
In RENDER it will be 1 frame behind the part's visual position for that frame
Also,
if the model is not rendered in-world, the part's matrix will not be updated
Paperdoll rendering and other UI renderings will not affect this matrix
overload 1:
models:partToWorldMatrix()
Method Property Fluent Description Representation
Return Value a Matrix4

ModelPart.setUV

Sets the UV of this part
This function is normalized,
meaning it works with values 0 to 1
If you say setUV(0.5,
0.25), for example, it will scroll by half of your texture width to the right, and one-fourth of the texture width downwards
overload 1:
models:setUV(uv)
Method Property Fluent Description Representation
uv accepts a Vector2
Return Value nil
overload 2:
models:setUV(u, v)
Method Property Fluent Description Representation
u accepts a Number
v accepts a Number
Return Value nil

ModelPart.getUVPixels

Gets the UV of this part
Automatically multiplies the result by getTextureSize()
Errors if the part has multiple different-sized textures of if the part is a Group
overload 1:
models:getUVPixels()
Method Property Fluent Description Representation
Return Value a Vector2

ModelPart.getTextureSize

Gets the width, height of this part's texture in pixels
Throws an error if this part has multiple different-sized textures on it,
or if the part is a Group
overload 1:
models:getTextureSize()
Method Property Fluent Description Representation
Return Value a Vector2

ModelPart.setPrimaryTexture

Sets the primary texture override of this part
Check the TextureType types in the list docs
If using "resource",
the second parameter should indicate the path to the Minecraft texture you want to use
If using "custom",
the second parameter should indicate a texture object
overload 1:
models:setPrimaryTexture(textureType)
Method Property Fluent Description Representation
textureType accepts a String
Return Value nil
overload 2:
models:setPrimaryTexture(resource, path)
Method Property Fluent Description Representation
resource accepts a String
path accepts a String
Return Value nil
overload 3:
models:setPrimaryTexture(custom, texture)
Method Property Fluent Description Representation
custom accepts a String
texture accepts a Texture
Return Value nil

ModelPart.removeTask

Removes the Task with the given name from this part
Removes ALL tasks if a name is not given
overload 1:
models:removeTask()
Method Property Fluent Description Representation
Return Value nil
overload 2:
models:removeTask(taskName)
Method Property Fluent Description Representation
taskName accepts a String
Return Value nil

ModelPart.getOpacity

Gets the opacity multiplier of this part
Note that opacity settings will only take effect if the part has a suitable Render Type for them,
mainly TRANSLUCENT
Check out modelPart.setPrimaryRenderType() for how to do this
overload 1:
models:getOpacity()
Method Property Fluent Description Representation
Return Value a Number

ModelPart.newItem

Adds a new Item Render Task on this part
overload 1:
models:newItem(taskName)
Method Property Fluent Description Representation
taskName accepts a String
Return Value a RenderTask

ModelPart.setParentType

Sets the parent type of the part
See the ParentType parts in the list docs for legal types
overload 1:
models:setParentType(parentType)
Method Property Fluent Description Representation
parentType accepts a String
Return Value nil

ModelPart.setLight

Sets the light level to be used when rendering this part
Values you give are 0 to 15,
indicating the block light and sky light levels you want to use
Passing nil will reset the lighting override for this part
overload 1:
models:setLight(light)
Method Property Fluent Description Representation
light accepts a Vector2
Return Value nil
overload 2:
models:setLight(blockLight, skyLight)
Method Property Fluent Description Representation
blockLight accepts an Integer
skyLight accepts an Integer
Return Value nil

ModelPart.getOverlay

Gets the overlay color you set earlier to this part
Does not interact with Minecraft's overlay system,
only retrieving values you set earlier with setOverlay()
overload 1:
models:getOverlay()
Method Property Fluent Description Representation
Return Value a Vector2

ModelPart.getLight

Gets the light level you set earlier to this part
Does not interact with Minecraft's lighting system,
only retrieving values you set earlier with setLight()
overload 1:
models:getLight()
Method Property Fluent Description Representation
Return Value a Vector2

ModelPart.setOverlay

Sets the overlay color to be used when rendering this part
Values you give are 0 to 15,
indicating the white overlay and the damage overlay levels you want to use
Passing nil will reset the overlay override for this part
overload 1:
models:setOverlay(overlay)
Method Property Fluent Description Representation
overlay accepts a Vector2
Return Value nil
overload 2:
models:setOverlay(whiteOverlay, hurtOverlay)
Method Property Fluent Description Representation
whiteOverlay accepts an Integer
hurtOverlay accepts an Integer
Return Value nil

ModelPart.getParentType

Returns the current parent type of the part
overload 1:
models:getParentType()
Method Property Fluent Description Representation
Return Value a String

ModelPart.newBlock

Adds a new Block Render Task on this part
overload 1:
models:newBlock(taskName)
Method Property Fluent Description Representation
taskName accepts a String
Return Value a RenderTask
a a