Upgrades
Create machine upgrades using Crafttweaker
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)
//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)
//You can add a custom tooltip to the machine upgrade item.
.tooltip(String tooltip)
//Add a modifier with mode input and operation addition
.addInput(CTRequirementType type, double value)
.addInput(CTRequirementType type, double value, String target)
.addInput(CTRequirementType type, double value, String target, double chance)
//Add a modifier with mode input and operation multiplication
.mulInput(CTRequirementType type, double value)
.mulInput(CTRequirementType type, double value, String target)
.mulInput(CTRequirementType type, double value, String target, double chance)
//Add a modifier with mode output and operation addition
.addOutput(CTRequirementType type, double value)
.addOutput(CTRequirementType type, double value, String target)
.addOutput(CTRequirementType type, double value, String target, double chance)
//Add a modifier with mode output and operation multiplication
.mulOutput(CTRequirementType type, double value)
.mulOutput(CTRequirementType type, double value, String target)
.mulOutput(CTRequirementType type, double value, String target, double chance)
//Finish (don't forget the semicolon ';')
.build();
Zenscript syntax
If not specified the target will be empty and the chance will be 1.0
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 consumption but also half it's duration.
mods.custommachinery.CMUpgradeBuilder.create(<item:minecraft:gold_ingot>)
.machine("custommachinery:power_crusher")
.mulInput(<requirementtype:custommachinery:energy>, 2)
.mulInput(<requirementtype:custommachinery:speed>, 0.5)
.build();
Last updated