Skip to content

Energy Element

Frinn38 edited this page Jun 7, 2022 · 10 revisions

The Energy Gui Element is used to display the content of an Energy Component present in the machine.

Energy Elements are defined in json with : "type": "custommachinery:energy".

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

Properties

Beside the 3 mandatory properties (type/x/y) and the 3 optional properties (width/height/priority) the Energy Element have 2 optional property.

emptytexture (Optional)

Description : 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.

Default : "custommachinery:textures/gui/base_energy_storage_empty" The default energy gui element empty texture.

Example : "emptytexture": "namespace:textures/energy_element_texture_empty.png" The element will search for a texture located in assets/namespace/textures/energy_element_texture_empty.png. The .png extension is mandatory.

Note : 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).

filledtexture (Optional)

Description : 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.

Default : "custommachinery:textures/gui/base_energy_storage_filled" The default energy gui element filled texture.

Example : "filledtexture": "namespace:textures/energy_element_texture_filled.png" The element will search for a texture located in assets/namespace/textures/energy_element_texture_filled.png. The .png extension is mandatory.

Note : 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.

Example

A typical Energy GUI Element :

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

Result :

energy_element

Clone this wiki locally