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)
//If maxAmount is not specified the default is 64.
mods.custommachinery.CMUpgradeBuilder.create(Item item, int maxAmount)

//Add a machine or a list of machines 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... tooltips)
//Use component for more formatting options,
//See https://docs.blamejared.com/1.18/en/vanilla/api/text/Component
.tooltip(Component... tooltips)

//Add a modifier to this upgrade.
//See below for modifier syntax.
.modifier(CMRecipeModifierBuilder modifier)

//Finish (don't forget the semicolon ';')
.build();

Making a modifier

See below the various methods used to build a recipe modifier and pass it to the upgrade.

Zenscript syntax

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

  • 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>

Example

A gold ingot put inside the Power Crusher will double it's energy consumption with a maximum of 1000FE but also half its duration time with a minimum of 100 ticks.