Background element

Change the size and background texture of the machine gui.

The background gui element work mostly the same way as the texture gui element.

It is used to display a background texture for the machine gui.

By default the machine gui doesn't have a background texture, meaning that the gui will be transparent if no background element are specified.

It can also be used to change the size of the gui.

The default machine gui size is 256x192px and the maximum size is 3840x2160px.

If a texture is specified the width/height of the gui will use the width/height of that texture (unless these properties are specified in the background element).

Background elements are defined in json with "type": "custommachinery:background".

You can only define 1 background element for a machine gui, if more than 1 background elements are added only the first will be used and the other ignored.

Properties

The background element has 1 mandatory property and 3 optional properties :

Mandatory property

"type": "custommachinery:background" //Mandatory to define a background element.

Optional properties

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 :

"texture": "custommachinery:textures/gui/base_background.png"

Example :

The file assets/textures/my_background_texture.png will be used for the slot element.

"texture": "namespace:textures/my_background_texture.png"
Width

Name : width

Description :

A positive integer that define the width of the machine gui.

Maximum allowed value : 3840

Default : 256

Example :

"width": 512 //The machine gui will be 512px wide.
Height

Name : height

Description :

A positive integer that define the height of the machine gui.

Maximum allowed value : 2160

Default : 192

Example :

"height": 512 //The machine gui will be 512px high.

Example :

The most basic background gui element that will fix 99% of your use-cases :

{
    "type": "custommachinery:background"
}

A background gui element that resize the machine gui to 192x256px

{
    "type": "custommachinery:size",
    "width": 192,
    "height": 256
}

A background gui element that change the default texture (size will be handled automatically) :

{
    "type": "custommachinery:background",
    "texture": "custommachinery:textures/custom_machine_gui_background.png"
}

Last updated