Chemical element (Mekanism)

Customize the chemical tanks in the machine gui

This element requires Custom Machinery Mekanism to be installed.

The chemical elements are used to display the content of a chemical component in the Machine GUI.

A chemical element must be associated with a chemical component using the id property. It will display the fluid stored in the component on the machine GUI.

If the element cannot find the component (usually because of an error in the id) the element will still be rendered but it will always be empty.

All of Mekanism chemicals types are supported :

  • Gas

  • Infusion

  • Pigment

  • Slurry

The type of chemical is defined in the type property (see below).

Properties

The fluid element has 4 mandatory properties and 6 optional properties :

Mandatory properties

"type": "custommachinery:gas" //Mandatory to define a gas chemical element.
OR
"type": "custommachinery:infusion" //Mandatory to define a infusion chemical element.
OR
"type": "custommachinery:pigment" //Mandatory to define a pigment chemical element.
OR
"type": "custommachinery:slurry" //Mandatory to define a slurry chemical 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
Id

Name : id

Description :

The id of the Chemical Component you want to link to this element. It must be the exact same id specified in the chemical component json id property.

Example :

The element will display the chemical component with id tank1, if no chemical component has this id it will do nothing.

"id": "tank1"

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
Texture

Name : texture

Description :

The location of the texture that will be rendered into the GUI.

The location must be referenced by : namespace:path/file.png The texture loader will search for textures in the assets/namespace folder, the .png extension is required or the file will not be found.

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.

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 :

The default fluid element texture :

custommachinery:textures/gui/base_fluid_storage.png

Example :

The file assets/textures/my_tank_texture.png will be used for the fluid element.

"texture": "namespace:textures/my_tank_texture.png"
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 basic gas chemical element linked to a gas chemical component using the id "tank1" and using the default texture :

{
    "type": "custommachinery:gas",
    "x": 20,
    "y": 20,
    "id": "tank1"
}

Last updated