Skip to content

Fluid Element

Frinn38 edited this page Jul 30, 2021 · 4 revisions

The Fluid Elements are used to display the content of a Fluid Component in the Machine GUI.

A Fluid Element must be associated with a Fluid Component using the id property. It will display the fluid stored in the Fluid Component on the Machine GUI.

Fluid Elements are defined in json with "type": "custommachinery:fluid".

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

Properties

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

ID (Mandatory)

Description : A String value that will be used to find a Fluid Component with the same id in the machine.

Example : "id": "tank1" Will find the Fluid Component with id "tank1" and show it's fluid into the Machine Gui.

Texture (Optional)

Description : The Fluid Element texture file to be rendered in the Machine GUI.

Default : custommachinery:textures/gui/base_fluid_storage.png The default fluid tank texture provided by Custom Machinery.

Example : "texture": "namespace:textures/my_tank_texture.png" The texture loader will use the file assets/namespace/textures/my_tank_texture.png as the tank texture.

Note : If a custom texture is provided the Fluid Element width and height properties will be adjusted automatically but the size and the position of the fluid rendered inside the tank cannot be changed.

Example :

A basic Fluid Element linked to a Fluid Component using the id "tank1" and using the default texture :

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

Result :

fluid_element

(Here the Fluid Component contains 4000mB of Water)

Clone this wiki locally