Skip to content

Texture Element

Frinn38 edited this page Mar 15, 2021 · 5 revisions

The Texture Gui Element is the most basic element, it is used to render a texture on the Machine GUI.

Texture Elements are defined in json with : "type": "custommachinery:texture".

The texture must be loaded into the game by either a resourcepack or a resource loader mod.

Note : By default the Machine GUI don't have any textures, not even a background. If you want a background four your Custom Machine GUI you need to use a Texture Element and set the x/y properties to 0/0.

A background texture should be a 256x192 image since it's the dimensions of the Machine GUI.

Properties

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

Texture (Mandatory)

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.

Example : "texture": "namespace:textures/my_texture.png" The file assets/textures/my_texture.png will be used by the Texture Element.

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

Example

A background Texture Element using the base background texture provided by Custom Machinery :

{
    "type": "custommachinery:texture",
    "x": 0,
    "y": 0,
    "texture": "custommachinery:textures/gui/base_background.png"
}

texture_element

Clone this wiki locally