Component modifier

Create a component modifier using KubeJS

Find all component types and targets that can be modified here.

//Create a modifier that add/multiply a value to any machine component.
//component must be specified using its id: "namespace:component"
//Value can be any numerical value.
//Id can be empty "" if the component doesn't have an id (like energy).
//Pick one of the 3 methods below :
CMComponentModifierBuilder.add(component, id, value)
CMComponentModifierBuilder.mul(component, id, value)
CMComponentModifierBuilder.exp(component, id, value)

//Specifying a target is mandatory
.target(String target)

//All methods below are optional

//Specify the maximum value that can be obtained after applying this modifier.
//It can be any numerical value.
//Default is POSITIVE_INFINITY.
.max(double max)

//Specify the minimum value that can be obtained after applying this modifier.
//It can be any numerical value.
//Default is NEGATIVE_INFINITY.
.min(double max)

//Change the tooltip displayed when holding shift while hovering the upgrade item.
//Default : a short string that describe the effect of this modifier.
.tooltip(String tooltip)
//Use Text.of("text here") for more formating options.
//See https://kubejs.com/wiki/kubejs/Text/
.tooltip(Text tooltip)

Example

A modifier that double the machine energy capacity

CMComponentModifierBuilder.mul("custommachinery:energy", "", 2)
.target("capacity")

A modifier that add 50mB max input to the fluid component with id "input1"

CMComponentModifierBuilder.add("custommachinery:fluid", "input1", 50)
.target("max_input")

Last updated