Button element
Add a clickable button to the machine gui
The button gui element is used to add a clickable button to the machine gui.
All button elements have a unique string id (that you must specify in the elements properties), when the button is pressed a boolean flag will be written in the machine data. This data can be accessed using Crafttweaker or KubeJS Function requirement.
Simply using data.buttonID
will give you a boolean that represent the current state of the button (true for pressed, false for released).
A Button requirement can also be used to make the recipe start only if the button is pressed.
Button elements are defined in json with : "type": "custommachinery:button"
.
Properties
The button gui element has 4 mandatory properties and 8 optional properties.
Mandatory properties
"type": "custommachinery:button" //Mandatory to define a button element.
Optional properties
Example
A basic button element using the base texture provided by Custom Machinery with a diamond :
{
"type": "custommachinery:button",
"x": 20,
"y": 20,
"id": "diamond",
"item": "minecraft:diamond"
}

Last updated