Texture element

Add a texture to the machine gui.

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.

By default all texture gui elements are hidden in jei, to make them show up see the "jei" property below.

Properties

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

Mandatory properties

"type": "custommachinery:texture" //Mandatory to define a texture 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
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).

Example :

The file assets/textures/my_texture.png will be used.

"texture": "namespace:textures/my_texture.png"

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
Jei

Name : jei

Description :

A boolean that define if the element should render in jei.

Default : false

Example :

The element will render in jei :

"jei": true
Texture hovered

Name : texture_hovered

Description :

The location of the texture that will be rendered into the GUI when the players mouse cursor is hovering the element.

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 :

None, the element will use the texture provided in the texture property.

Example :

The file assets/textures/my_texture.png will be used.

"texture_hovered": "namespace:textures/my_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 !"

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"
}