Modifiers

Make a machine upgrade able to alter a recipe requirement.

Requirement modifiers are used to tweak some properties of a recipe requirement.

They are defined in json inside of the modifiers property of the machine upgrade item json.

List of properties that can be modified

RequirementTargetModified property

-

amount

"chance"

chance

"chance"

chance

-

amount

"radius"

radius

"chance"

chance

-

amount

"chance"

chance

"time"

time

"level"

level

"radius"

radius

"chance"

chance

-

amount

"chance"

chance

-

amount

"chance"

chance

-

amount

"radius"

radius

"chance"

chance

-

amount

"chance"

chance

-

amount

"chance"

chance

-

amount

"chance"

chance

-

light

"luck"

luck

"power"

power

Speed

-

The recipe's time property

Function

"chance"

chance

Properties

The requirement modifier has 4 mandatory properties and 2 optional property.

Mandatory properties

Requirement

Name : requirement

Description :

The type of the requirement you want to apply the modifier to. This is the same type as the one you specify in the type property when defining the requirement in the recipe json.

Example :

"requirement": "custommachinery:energy"

This modifier will be applied to the energy requirement.

Note :

The recipe duration can also be modified with this system.

Use custommachinery:speed to target it.

Warning : Using this as a requirement will alter the recipe process duration, which is the opposite of the speed (the lower the duration the faster the speed).

Mode

Name : mode

Description :

The mode of the requirement you want to apply the modifier to. It can be either input or output but not both.

Example :

"mode": "input"

This modifier will be applied only on input requirements.

Operation

Name : operation

Description :

The mathematical operation that will be applied to the targeted requirement property by the modifier. The available operations are :

  • addition : The resulting value will be the sum of the base requirement value and the modifier value multiplied by the amount of upgrades. final_value = base_value + upgrade_modifier * upgrade_amount

  • multiplication : The resulting value will be the multiplication of the base requirement value and the modifier value multiplied by the amount of upgrades. final_value = base_value * upgrade_modifier * upgrade_amount

  • exponential : The resulting value will be the multiplication of the base requirement value and the modifier value powered to the amount of upgrades. final_value = base_value * upgrade_modifier ^ upgrade_amount

Example :

"operation": "multiplication"

The base requirement value (defined in the recipe) will be multiplicated by the value defined in this modifier.

Modifier

Name : modifier

Description :

The value (double) to add or multiply to the base requirement value. It can be positive or negative and support decimal numbers.

Example :

"modifier": 0.5

Optional properties

Target

Name : target

Description :

Some requirement have more than one value that can be modified.

In that case the target property can be used to define which one of the requirement property you want to modify.

For example some requirement have a chance property that can be modified by the upgrade, simply use "target": "chance" to target the chance property instead of the default one.

Default : empty

The modifier will be applied to the default property of the defined requirement.

Example :

In case of the Entity Requirement the default property is amount so if you want to modify the radius property you can do :

"target": "radius"
Chance

Name : chance

Description :

The chance the modifier will be applied to the requirement, this have nothing to do with the chance property some requirement have and will be applied independently.

This value must be between 0 and 1 where 0 is 0% chance to be applied and 1 is 100% chance.

Default : 1

The modifier have 100% chance to be applied on the requirement.

Example :

"chance": 0.4

The modifier have 40% chance to be applied on the requirement.

Max

Name : max

Description :

A positive integer that define the maximum value obtained after applying this upgrade.

Fox example if the modifier multiply all energy output by 2 and the max is set to 1000, the maximum energy output by the recipe will be 1000FE, even if it should be greater after the multiplication.

Default : POSITIVE_INFINITY

Example :

"max": 42

Whatever the modifier does, the resulting value won't be greater than 42.

Min

Name : min

Description :

A positive integer that define the minimum value obtained after applying this upgrade.

Fox example if the modifier divide all items consumed by 2 and the min is set to 1, the recipe will always consume 1 item.

Default : NEGATIVE_INFINITY

Example :

"min": 42

Whatever the modifier does, the resulting value won't be lower than 42.

Tooltip

Name : tooltip

Description :

The tooltip that will render when a player hover any machine upgrade item in a gui while holding shift. This is a text component.

Default :

A short string that describe what the modifier does : -50% Energy input

Example :

"tooltip": {
    "text": "Overclock: Recipe time divided by 2",
    "color": "orange"
}

The tooltip will be "Overclock: Recipe time divided by 2" in orange.

Example

A modifier that half the time needed to process a recipe :

{
    "requirement": "custommachinery:speed",
    "mode": "input",
    "operation": "multiplication",
    "modifier": 0.5
}

A modifier that double the energy per tick consumed by a recipe :

{
    "requirement": "custommachinery:energy_per_tick",
    "mode": "input",
    "operation": "multiplication",
    "modifier": 2.0
}

A modifier that has 50% chance to add 1 item produced by a recipe :

{
    "requirement": "custommachinery:item",
    "mode": "output",
    "operation": "addition",
    "modifier": 1,
    "chance": 0.5
}

Last updated