Config element
Add an I/O side config button to the machine gui
The config gui element is used to add an I/O side config button on the Machine GUI.
Config elements are defined in json with : "type": "custommachinery:config"
.
If you don't add this element the players won't be able to configurate I/O of the machine, that can be useful if you want to make a machine with defined I/O sides.
Properties
The config element has 3 mandatory properties and 7 optional properties :
Mandatory properties
"type": "custommachinery:config" //Mandatory to define a config element.
Optional properties
Texture
Name : texture
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_config.png"
Example :
The file assets/textures/my_texture.png
will be used.
"texture": "namespace:textures/my_texture.png"
Texture hovered
Name : texture_hovered
texture_hovered
Description :
The location of the texture that will be rendered into the GUI, only when the element is hovered by the player mouse cursor.
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_config_hovered.png"
Example :
The file assets/textures/my_texture.png
will be used.
"texture_hovered": "namespace:textures/my_texture.png"
Priority
Name : priority
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
Tooltips
Name : tooltips
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 basic config element using the base texture provided by Custom Machinery :
{
"type": "custommachinery:config",
"x": 20,
"y": 20
}
Last updated