# Text element

Text element is 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.

{% hint style="info" %}
By default all text gui elements are hidden in jei, to make them show up see the "jei" property below.
{% endhint %}

### Properties

The text element has 4 mandatory properties and 4 optional properties :&#x20;

#### Mandatory properties

```json5
"type": "custommachinery:text" //Mandatory to define a text element.
```

<details>

<summary>X</summary>

#### Name : `x`

#### Description :&#x20;

A positive integer value that define the x axis position of the element to be displayed on the Machine GUI.

#### Example :&#x20;

The element will be rendered 100px to the right from the top-left corner of the gui.

```json5
"x": 100
```

</details>

<details>

<summary>Y</summary>

#### Name : `y`

#### Description :&#x20;

A positive integer value that define the y axis position of the element to be displayed on the Machine GUI.

#### Example :&#x20;

The element will be rendered 100px to the bottom from the top-left corner of the gui.

```json5
"y": 100
```

</details>

<details>

<summary>Text</summary>

#### Name : `text`

#### Description :&#x20;

The Text to be rendered on the GUI.

It can be a simple string or a translation key.

#### Example :&#x20;

```json
"text": "An Awesome Title For My Machine GUI !"
```

</details>

#### Optional properties

<details>

<summary>Priority</summary>

#### Name : `priority`

#### Description :&#x20;

An integer property that define the priority of the Element to be rendered.&#x20;

Elements with higher priority will be rendered first. If 2 elements are at the same position the first to be rendered will be under and the last will be above.

#### Default : 0

#### Example :&#x20;

The element will be rendered under each element that have a priority lower than 1000.

```json5
"priority": 1000
```

</details>

<details>

<summary>Alignment</summary>

#### Name : `alignment`

#### Description :&#x20;

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 :&#x20;

```json5
"alignment": "center" //The center of the text string will be at the element position.
```

</details>

<details>

<summary>Color</summary>

#### Name : color

#### Description :&#x20;

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

Go [here](https://www.shodor.org/stella2java/rgbint.html) if you don't know how to calculate an integer color from RGB values.

#### Default : 0

Black text.

#### Example :&#x20;

```json5
"color": 16711680 //Full red.
```

</details>

<details>

<summary>Jei</summary>

#### Name : `jei`

#### Description :&#x20;

A boolean that define if the element should render in jei.

#### Default : `false`

#### Example :&#x20;

The element will render in jei :&#x20;

```json
"jei": true
```

</details>

### Example

A basic text element :

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

Result :

![A text element](https://github.com/Frinn38/Custom-Machinery/raw/1.16.5/wiki/text_element.png)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://frinn.gitbook.io/custom-machinery-1.18/creating-custom-machines/machine-gui/text-element.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
