BlockTask
A task for rendering a Block from newBlock
For this entire page assume:
local myBlock = models:newBlock("myCoolBlocksName")
setBlock(block: BlockState): BlockTask
Sets the Block for this task render
Example:
myBlock:setBlock("mycelium")
remove(): BlockTask
Removes this block task from the parent model part
Example:
myBlock:remove()
getName(): string
Get this task's name
Example:
myBlock:getName()
setVisible(state: boolean): BlockTask
Sets whether or not this task should be rendered
Example:
local myPage = action_wheel.newPage()
myPage:newAction():setOnToggle(function(state)
myBlock:setVisible(state)
end)
isVisible(): boolean
Checks if this task is visible
Example:
if myBlock:isVisible() then
-- do something
end
setLight(blockLight: number?, skyLight: number?): BlockTask
Sets the light override value of this task Values are given from 0 to 15, indicating the block light and sky light levels you want to use Passing nil will reset the lighting override for this task
Example:
local blockLight = world.getLightLevel(player:getPos())
local skyLight = world.getSkyLightLevel(player:getPos())
myBlock:setLight(blockLight, skyLight)
getLight(): Vector2
Returns the light override value of this task
Example:
myBlock:getLight()
setOverlay(whiteOverlay: number?, hurtOverlay: number?): BlockTask
Sets the overlay override value of this task 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 task
Example:
local hurt = player:getNbt.HurtTime > 0
myBlock:setOverlay(hurt and 0 or nil, 1)
getOverlay(): Vector2
Returns the overlay override value of this task
Example:
myBlock:getOverlay()
setPos(pos: Vector3): BlockTask
Sets the position of the task, relative with its attached part Uses model coordinates
Example:
myBlock:setPos(0, 16, 0)
getPos(): Vector3
Gets this task position
Example:
myBlock:getPos()
setRot(rot: Vector3): BlockTask
Sets the rotation of the task, relative with its attached part
Example:
myBlock:setRot(0, 45, 22.5)
getRot(): Vector3
Gets this task rotation
Example:
myBlock:getRot()
setScale(scale: Vector3): BlockTask
Sets the scale of the task, relative with its attached part
Example:
myBlock:setScale(0.4, 0.4, 0.4) -- myBlock:setScale(0.4) also works
getScale(): BlockTask
Gets this task scale
Example:
myBlock:getScale()
setMatrix(matrix: Matrix4): BlockTask
Sets the given matrix as the position matrix for this block task 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 block task If you call setPos() or a similar function, the effects of setMatrix() will be overwritten
Example:
myBlock:setMatrix(matrices.mat4())
getPositionMatrix(): Matrix4
Recalculates the matrix for this block task, based on its current position, rotation, scale, and pivot, then returns this matrix
Example:
myBlock:getPositionMatrix()
getPositionMatrixRaw(): Matrix4
Returns the position matrix for this block task The Raw version of the function is different in that it doesn't recalculate the matrix before getting it
Example:
myBlock:getPositionMatrixRaw()
getNormalMatrix(): Matrix3
Recalculates the normal matrix for this block task, based on its current position, rotation, scale, and pivot, then returns this matrix
Example:
myBlock:getNormalMatrix()
getNormalMatrixRaw(): Matrix3
Returns the normal matrix for this block task The Raw version of the function is different in that it doesn't recalculate the matrix before returning it
Example:
myBlock:getNormalMatrixRaw()