Skip to content

Text Element

Frinn38 edited this page Jul 30, 2021 · 4 revisions

Text Element are used to render a text on the Machine GUI.

Text Elements are defined in json with : "type": "custommachinery:text".

The text must be a single string and can't have multiple lines (use multiple Text Elements for that).

Currently you can't change the size of the text.

Properties

Beside the 3 mandatory properties (type/x/y) and the 3 optional properties (width/height/priority) the Text Element have 1 mandatory property and 2 optional properties.

Text (Mandatory)

Description : The Text to be rendered on the GUI.

Example : "text": "An Awesome Title For My Machine GUI !"

Alignment (Optional)

Description : How the text is aligned compared to the Element position. Available values are left/center/right

Default : left The left of the text string will be at the Element position.

Example : "alignment": "center" The center of the text string will be at the Element position.

Color (Optional)

Description : An integer value that define the color of the text. The value must be an integer encoded like 0xRRGGBB.

Default : 0 Black text.

Example : "color": 16711680 Full red.

Example

A basic Text Element :

{
    "type": "custommachinery:text",
    "x": 20,
    "y": 20,
    "text": "My Awesome Machine"
}

Result :

text_element

Clone this wiki locally