# Progress bar element

The progress bar element is used to render a progress bar in the Machine GUI (see the arrow that is slowly filled in the furnace GUI while smelting ? That's a progress bar).

Progress bar elements are defined in json with : `"type": "custommachinery:progress"`.

{% hint style="warning" %}
You can add as much Progress Bar Elements as you want but they will all be filled at the same time since the machine can only process 1 recipe at a time.
{% endhint %}

When hovering the progress bar in jei with advanced item tooltips enabled (F3 + H), the progress bar tooltip will display the recipe ID. You can disable the need of enabling item tooltips in the config by setting `needAdvancedInfoForRecipeID` to false.

{% hint style="info" %}
If JEI is installed you can click on the progress bar element in the machine gui to display in JEI all the recipes for this machine.
{% endhint %}

### Properties

The progress bar element has 3 mandatory properties and 9 optional properties :&#x20;

#### Mandatory properties

```json5
"type": "custommachinery:progress" //Mandatory to define a progress bar 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>

#### Optional properties

<details>

<summary>Width</summary>

#### Name : `width`

#### Description :&#x20;

A positive integer value that define the width of the element on the Machine GUI.

#### Default :&#x20;

The same width as the texture specified in the `texture` property.

#### Example :&#x20;

The width of the element will be 100px.

```json5
"width": 100
```

</details>

<details>

<summary>Height</summary>

#### Name : `height`

#### Description :&#x20;

A positive integer value that define the height of the element on the Machine GUI.

#### Default :&#x20;

The same height as the texture specified in the `texture` property.

#### Example :&#x20;

The height of the element will be 100px.

```json5
"height": 100
```

</details>

<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>Empty texture</summary>

#### Name : `texture_empty`

#### Description :&#x20;

Point to a texture to use as the empty element texture. The texture must be loaded in-game with a resource pack or a loader mod.

The texture can be any size, if the texture size is different from the default size the `width` and `height` properties of the element will be automatically changed to fit the texture size if not provided.&#x20;

If the `width` and/or `height` properties of the element are provided, the texture will be stretched to fit the dimensions of the element (it can render weirdly in that case).

#### Default :&#x20;

```json
"texture_empty": "custommachinery:textures/gui/base_progress_empty"
```

#### Example :&#x20;

```json5
"texture_empty": "namespace:textures/progress_element_texture_empty.png"
```

The element will search for a texture located in `assets/namespace/textures/progress_element_texture_empty.png`

**The .png extension is mandatory**.

</details>

<details>

<summary>Filled texture</summary>

#### Name : `texture_filled`

#### Description :&#x20;

Point to a texture to use as the filled element texture. The texture must be loaded in-game with a resource pack or a loader mod.

The filled texture will be rendered on top on the empty texture, how much the filled texture overlap the empty texture is relative to the amount of energy inside the energy component.

#### Default :&#x20;

```
"texture_filled": "custommachinery:textures/gui/base_progress_filled"
```

#### Example :&#x20;

```json5
"texture_filled": "namespace:textures/progress_element_texture_filled.png"
```

The element will search for a texture located in `assets/namespace/textures/progress_element_texture_filled.png`

**The .png extension is mandatory**.

</details>

<details>

<summary>Tooltips</summary>

#### Name : `tooltips`

#### Description :&#x20;

A list of [Text components](https://frinn.gitbook.io/custom-machinery-1.19/misc/text-component) that will be shown as tooltips when the player mouse cursor hover the element.

Each tooltips of the list will be a new line.

#### Example :&#x20;

Replace the default tooltips with a single line that say "Click me !" :&#x20;

```json
"tooltips": "Click me !"
```

</details>

<details>

<summary>Direction</summary>

#### Name : `direction`

#### Description :&#x20;

The direction (right/left/top/bottom) of the arrow. When the recipe is processing the arrow will fill to this direction (from the opposite).

If using custom textures they will not be rotated, but they will be filled according to the specified direction.

#### Default : `right`

The arrow point to the right and is filled from the left to the right.

#### Example :&#x20;

The arrow point to the bottom and is filled from the top to the bottom.

```json5
"direction": "bottom"
```

</details>

<details>

<summary>Start</summary>

#### Name : `start`

#### Description :&#x20;

A positive decimal value that represent at which percentage of the recipe progress the bar should start rendering.

The specified value must be between 0.0 (start of the recipe) and 1.0 (end of the recipe).

#### Default : `0.0`

#### Example :&#x20;

The progress bar will start rendering at 30% of the recipe progress : &#x20;

```json
"start": 0.3
```

</details>

<details>

<summary>End</summary>

#### Name : `end`

#### Description :&#x20;

A positive decimal value that represent at which percentage of the recipe progress the bar should stop rendering.

The specified value must be between 0.0 (start of the recipe) and 1.0 (end of the recipe).

#### Default : `1.0`

#### Example :&#x20;

The progress bar will stop rendering at 80% of the recipe progress : &#x20;

```json
"start": 0.8
```

</details>

### Example

A basic Progress Bar Element using the default textures :

```json5
{
    "type": "custommachinery:progress",
    "x": 116,
    "y": 50
}
```

Result :

![Progress bar base texture](https://github.com/Frinn38/Custom-Machinery/raw/1.16.5/wiki/progress_bar_element.png)

In this example JEI is installed and display a "Show Recipes" tooltip when the mouse hover the element.


---

# 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.19/creating-custom-machines/machine-gui/progress-bar-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.
