ItemTask
A task for rendering an Item from newItem
For this entire page assume:
local myItem = models:newItem("myCoolItemsName")
setItem(item: ItemStack): ItemTask
Sets the Item for this task render
Example:
myItem:setItem("slime_ball")
setDisplayMode(displayMode: DisplayMode): ItemTask
Sets the item display mode for this task
Example:
myItem:setDisplayMode("GROUND")
getDisplayMode(): DisplayMode
Gets this task item display mode
Example:
myItem:getDisplayMode()
remove(): ItemTask
Removes this item task from the parent model part
Example:
myItem:remove()
getName(): string
Get this task's name
Example:
myItem:getName()
setVisible(state: boolean): ItemTask
Sets whether or not this task should be rendered
Example:
local myPage = action_wheel.newPage()
myPage:newAction():setOnToggle(function(state)
myItem:setVisible(state)
end)
isVisible(): boolean
Checks if this task is visible
Example:
if myItem:isVisible() then
-- do something
end
setLight(blockLight: number?, skyLight: number?): ItemTask
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())
myItem:setLight(blockLight, skyLight)
getLight(): Vector2
Returns the light override value of this task
Example:
myItem:getLight()
setOverlay(whiteOverlay: number?, hurtOverlay: number?): ItemTask
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
myItem:setOverlay(hurt and 0 or nil, 1)
getOverlay(): Vector2
Returns the overlay override value of this task
Example:
myItem:getOverlay()
setPos(pos: Vector3): ItemTask
Sets the position of the task, relative with its attached part Uses model coordinates
Example:
myItem:setPos(0, 16, 0)
getPos(): Vector3
Gets this task position
Example:
myItem:getPos()
setRot(rot: Vector3): ItemTask
Sets the rotation of the task, relative with its attached part
Example:
myItem:setRot(0, 45, 22.5)
getRot(): Vector3
Gets this task rotation
Example:
myItem:getRot()
setScale(scale: Vector3): ItemTask
Sets the scale of the task, relative with its attached part
Example:
myItem:setScale(0.4, 0.4, 0.4) -- myItem:setScale(0.4) also works
getScale(): ItemTask
Gets this task scale
Example:
myItem:getScale()
setMatrix(matrix: Matrix4): ItemTask
Sets the given matrix as the position matrix for this item 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 item task If you call setPos() or a similar function, the effects of setMatrix() will be overwritten
Example:
myItem:setMatrix(matrices.mat4())
getPositionMatrix(): Matrix4
Recalculates the matrix for this item task, based on its current position, rotation, scale, and pivot, then returns this matrix
Example:
myItem:getPositionMatrix()
getPositionMatrixRaw(): Matrix4
Returns the position matrix for this item task The Raw version of the function is different in that it doesn't recalculate the matrix before getting it
Example:
myItem:getPositionMatrixRaw()
getNormalMatrix(): Matrix3
Recalculates the normal matrix for this item task, based on its current position, rotation, scale, and pivot, then returns this matrix
Example:
myItem:getNormalMatrix()
getNormalMatrixRaw(): Matrix3
Returns the normal matrix for this item task The Raw version of the function is different in that it doesn't recalculate the matrix before returning it
Example:
myItem:getNormalMatrixRaw()