Skip to content
ben-mkiv edited this page Dec 9, 2023 · 4 revisions

2D Overlay Widget

Item2D

widget = component.glasses.addItem2D()
-- adds a Item Icon to the 2D Overlay
setItem(String:name, Integer:meta):boolean
-- sets the widget item by its name and metaindex
-- returns false if the item couldn't be found/set, otherwise it's true

Examples

-- add widget which shows an iron sword
glassesTerminal = require("component").glasses
glassesTerminal.removeAll()

Widget_ItemIcon = glassesTerminal.addItem2D()
Widget_ItemIcon.setItem("minecraft:iron_sword", 0)
Widget_ItemIcon.addTranslation(50, 50, 0) -- modifier #1 (translate the render position on the viewport)
Widget_ItemIcon.addScale(40, 40, 40)      -- modifier #2 (scale the render matrix)

methods