Bar element
Add a bar that fills depending on a number value stored in the machine.
The bar gui element can be used to display a number in the form of a fillable bar (the default texture is the same one as the energy gui element).
The number value must be stored in the machine data, which is accessible only by using Crafttweaker or KubeJS scripts.
Example: setting a number in the data from a script
.requireFunctionEachTicks(ctx => {
//Set the variable named "amount" to 10
//"amount" can be replaced by anything else,
//as long as it match the ID specified in the bar gui element properties.
ctx.machine.data.amount = 10;
return ctx.success()
})
Bar elements are defined in json with : "type": "custommachinery:bar"
.
Properties
The bar gui element has 4 mandatory properties and 10 optional properties.
Mandatory properties
"type": "custommachinery:bar" //Mandatory to define a bar element.
Optional properties
Example
A bar with default texture, which show a number stored in the machine data with id "amount", which is between 0 and 10000 :
{
"type": "custommachinery:bar",
"x": 20,
"y": 20,
"id": "amount",
"max": 10000
}
Last updated