Skip to content

CT Machine Upgrades

Frinn38 edited this page Jul 22, 2021 · 5 revisions

Custom Machine upgrades can be made with Crafttweaker.

Create a .zs file in the script folder (ex: custom_machine_upgrades.zs) and look at the example below to see all the available methods to create a Custom Machine upgrade with Crafttweaker.

If you're not familiar about custom machine upgrades see the wiki page.

Creating custom machine upgrade with Crafttweaker

//Create the upgrade builder and give it the item that will act as upgrade and the max amount of this upgrade that can be used in a machine.
mods.custommachinery.CMUpgradeBuilder.create(Item item, @Optional(64) int maxAmount)
//Add a machine that will accept this upgrade, the machine ID must be "namespace:id" like "custommachinery:my_machine" if the json is located in (my_datapack)/data/custommachinery/machines/my_machine.json
.machine(String machineID)
//Add a modifier with mode input and operation addition
.addInput(CTRequirementType type, double value, @Optional("") String target, @Optional(1.0) double chance)
//Add a modifier with mode input and operation multiplication
.mulInput(CTRequirementType type, double value, @Optional("") String target, @Optional(1.0) double chance)
//Add a modifier with mode output and operation addition
.addOutput(CTRequirementType type, double value, @Optional("") String target, @Optional(1.0) double chance)
//Add a modifier with mode output and operation multiplication
.mulOutput(CTRequirementType type, double value, @Optional("") String target, @Optional(1.0) double chance)
//Finish (don't forget the semicolon ';')
.build();

Zenscript syntax

  • All parameters with @Optional(defaultValue) in front of it can be omitted, the default value will be used instead.
  • If a method have several @Optional parameters and you want to specify one, all before that one must also be specified.
    (Example : .addInput(<requirementtype:custommachinery:speed>, 5, 0.5) is invalid because the @Optional("") double target parameter must also be specified.
  • CTRequirementType is specified with: <requirementtype:namespace:requirement_type_id> ex: <requirementtype:custommachinery:item>

Examples

A gold ingot put inside the Power Crusher will double it's energy comsumption but also speed it by 50%

mods.custommachinery.CMUpgradeBuilder.create(<item:minecraft:gold_ingot>)
.machine("custommachinery:power_crusher")
.mulInput(<requirementtype:custommachinery:energy>, 2)
.mulInput(<requirementtype:custommachinery:speed>, 1.5)
.build();

Clone this wiki locally