Mana element

Customize the mana bar of the machine gui.

The mana gui element is used to display the content of a Mana Component present in the machine.

Mana elements are defined in json with: "type": "custommachinery:mana" .

Note that if you didn't set a Mana Component in the machine json the Mana Element will still work but always show a value of 0 mana.

Properties

The mana element has 3 mandatory properties and 5 optional properties:

Mandatory properties

"type": "custommachinery:mana" //Mandatory to define a mana element.
X

Name : x

Description :

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

Example :

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

"x": 100
Y

Name : y

Description :

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

Example :

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

"y": 100

Optional properties

Width

Name : width

Description :

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

Default :

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

Example :

The width of the element will be 100px.

"width": 100
Height

Name : height

Description :

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

Default :

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

Example :

The height of the element will be 100px.

"height": 100
Priority

Name : priority

Description :

An integer property that define the priority of the Element to be rendered.

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 :

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

"priority": 1000
Tooltips

Name : tooltips

Description :

A list of Text components 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 :

Replace the default tooltips with a single line that say "Click me !" :

"tooltips": "Click me !"
Highlight

Name : highlight

Description :

A boolean property, if true the element will highlight (become slightly brighter) when the player mouse hover it. If false the element will not highlight on mouse hover.

Default : true

Example :

The element will not highlight on mouse hover :

"highlight": false

Example

A typical Mana GUI Element:

{
    "type": "custommachinery:mana",
    "x": 20,
    "y": 20
}

Result:

Last updated