CraftTweaker for Machines - GregTechCEu/GregTech GitHub Wiki

Introduction to GregTech Machine Recipes

GTCEu stores all recipes in something called a RecipeMap, which can be added to or removed from. To retrieve RecipeMaps, you need to import the corresponding package: import mods.gregtech.recipe.RecipeMap.

RecipeMaps are defined by name, and are also retrieved by their name.

Example:

import mods.gregtech.recipe.RecipeMap;

// preferred method
val alloy_smelter as RecipeMap = <recipemap:alloy_smelter>;

// alternative method
val alloy_smelter_alternate as RecipeMap = RecipeMap.getByName("alloy_smelter");

It is often convenient to store these RecipeMaps as static or global variables for easy use across multiple scripts.

GregTech CEu RecipeMap List

This list differs slightly from GTCE. Machines with changed names are marked with an asterisk and are in bold. Machines also no longer have minimum requirements, so you do not need to use a certain amount of inputs or outputs of any type.

Machine Name RecipeMap Name Item Inputs Item Outputs Fluid inputs Fluid Outputs
Alloy Smelter alloy_smelter 2 1 0 0
Arc Furnace arc_furnace 1 4 1 1
Assembling Machine assembler 9 1 1 0
Assembly Line assembly_line 16 1 4 0
Autoclave autoclave 2 2 1 1
*Bending Machine bender 2 1 0 0
*Brewing Machine brewery 1 0 1 1
Canning Machine canner 2 2 1 1
Centrifuge centrifuge 2 6 1 6
Chemical Bath chemical_bath 1 6 1 1
Chemical Reactor chemical_reactor 2 2 3 2
Circuit Assembler circuit_assembler 6 1 1 0
*Coke Oven coke_oven 1 1 0 1
Compressor compressor 1 1 0 0
Cracking Unit cracker 1 0 2 2
*Cutting Machine cutter 1 2 1 0
Distillation Tower distillation_tower 0 1 1 12
Distillery distillery 1 1 1 1
*Electric Blast Furnace electric_blast_furnace 3 3 1 1
*Electric Furnace electric_furnace 1 1 0 0
Electrolyzer electrolyzer 2 6 1 6
Electromagnetic Separator electromagnetic_separator 1 3 0
Extractor extractor 1 1 0 1
Extruder extruder 2 1 0 0
Fermenter fermenter 1 1 1 1
Fluid Heater fluid_heater 1 0 1 1
Fluid Solidifier fluid_solidifier 1 1 1 0
Forge Hammer forge_hammer 1 1 0 0
Forming Press forming_press 6 1 0 0
Fusion Reactor fusion_reactor 0 0 2 1
Gas Collector gas_collector 1 0 0 1
Implosion Compressor implosion_compressor 3 2 0 0
Large Chemical Reactor large_chemical_reactor 3 3 5 4
Laser Engraver laser_engraver 2 1 0 0
Lathe lathe 1 2 0 0
Macerator macerator 1 4 0 0
Mass Fabricator mass_fabricator 1 0 1 2
Mixer mixer 6 1 2 1
Ore Washing Plant ore_washer 2 3 1 0
Packager packer 2 2 0 0
Polarizer polarizer 1 1 0 0
*Primitive Blast Furnace primitive_blast_furnace 3 3 0 0
*Pyrolyse Oven pyrolyse_oven 2 1 1 1
Replicator replicator 1 1 2 1
Rock Breaker rock_breaker 1 4 0 0
Scanner scanner 2 1 1 0
Sifting Machine sifter 1 6 0 0
Thermal Centrifuge thermal_centrifuge 1 3 0 0
Vacuum Freezer vacuum_freezer 1 1 1 1
Wiremill wiremill 2 1 0 0

Energy Generator Recipemaps:

Generator Name RecipeMap Name Item Inputs Item Outputs Fluid inputs Fluid Outputs
Combustion Generator combustion_generator 0 0 1 0
Gas Turbine gas_turbine 0 0 1 0
Plasma Generator plasma_generator 0 0 1 1
Semi Fluid Generator semi_fluid_generator 0 0 1 0
Steam Turbine steam_turbine 0 0 1 1

New Machines to CEu:

  • Fusion Reactor
  • Large Chemical Reactor
  • Assembly Line
  • Circuit Assembler
  • Mass Fabricator
  • Replicator
  • Scanner
  • Gas Collector
  • Rock Breaker

Removed Machines from CEu:

  • Microwave - Removed and to be re-added with increased functionality by an addon, GregTech Food Option
  • Fluid Canner - Now combined with Canning Machine
  • Fluid Extractor - Now combined with the Extractor
  • Plasma Arc Furnace - Now combined with Arc Furnace
  • UU-Matter Producer - Previously unimplemented, now removed
  • Thermal Generator - Previously unimplemented, now removed

RecipeBuilders

RecipeBuilders are what actually create the recipes for machines. It is very similar to CEu's new Material Builder system. It works exactly like GTCE's system.

For those who have used CE's RecipeBuilders in the past: the Primitive Blast Furnace and Coke Oven are no longer special cases, and now use the normal RecipeBuilder syntax.

After getting a instance of RecipeMap, you can define recipes by using their builder. It is a bit like Stream<T> in Java, with full functionality to control your recipe's behavior.

Starting a builder:

my_recipeMap_variable.recipeBuilder();
// example
<recipemap:assembler>.recipeBuilder();

This will not do anything on its own. It requires more methods to be called on top of it in order to create a recipe.

RecipeBuilder Methods

Item Inputs

// IIngredient inputs for the recipe
.inputs(IIngredient[])
// examples
.inputs(<minecraft:iron_ingot>)
.inputs(<minecraft:iron_ingot>, <ore:dustGold> * 2, <metaitem:plateTitanium>)
.inputs([<minecraft:iron_ingot>, <ore:dustGold>, <metaitem:plateTitanium> * 64])

This method takes as many IIngredients as the RecipeMap supports.

Fluid Inputs

// ILiquidStack fluid inputs for the recipe
.fluidInputs(ILiquidStack[])
// examples
.fluidInputs(<liquid:water>)
.fluidInputs(<liquid:water>, <liquid:brass> * 1296)
.fluidInputs([<liquid:water> * 288, <liquid:brass>])

This method takes as many ILiquidStacks as the RecipeMap supports. Note that fluid input predicates are not supported.

It might be required for you to put the arguments of this function in an array ([]) if you encounter any issues, so better be safe than sorry and add the brackets.

Item Outputs

// IItemStack outputs for the recipe
.outputs(IItemStack[])
// examples
.outputs(<minecraft:iron_ingot>)
.outputs(<minecraft:iron_ingot>, <metaitem:plateTitanium>)
.outputs([<minecraft:iron_ingot>, <metaitem:plateTitanium> * 64])

This method takes as many IItemStacks as the RecipeMap supports.

Fluid Outputs

// ILiquidStack fluid outputs for the recipe
.fluidOutputs(ILiquidStack[])
// examples
.fluidOutputs(<liquid:water>)
.fluidOutputs(<liquid:water>, <liquid:brass> * 1296)
.fluidOutputs([<liquid:water> * 288, <liquid:brass>])

This method takes as many ILiquidStacks as the RecipeMap supports.

It might be required for you to put the arguments of this function in an array ([]) if you encounter any issues, so better be safe than sorry and add the brackets.

Chanced Item Outputs

// IItemStack output, intitial output chance, tier output chance boost. 10000 is 100% chance
.chancedOutput(IItemStack, 0-10000, 0-10000)
// example
// has 1% chance for a diamond + 0.5% for each overclock tier
.chancedOutput(<minecraft:diamond>, 100, 50)

This method takes a single IItemStack and adds it to the recipe's outputs with a chance. It counts towards the RecipeMap's total output amount. The initial output chance and chance boost must be specified. 10000 is a 100% chance, 0 is a 0% chance.

Configuration Circuits

// circuit number to use, from 0-32
.circuit(int)
// example
.circuit(10)

Adds a configuration circuit to the recipe. Takes an int to determine the configuration number, ranging from 0-32 inclusive.

The configuration circuit is automatically added as a not consumed input with this method. It counts towards the total item input amount.

This can also be performed with a property, but this method is simpler and easier to use.

Not Consumable Item Inputs

// Works as .inputs(), but the item doesn't get consumed
.notConsumable(IIngredient[])
// examples
.notConsumable(<ore:dustChrome>)
.notConsumable(<ore:dustChrome>, <minecraft:clay>)

This method takes as many IItemStacks as the RecipeMap supports. It makes the items specified not consumed when the recipe is run. It counts towards the total item input amount.

Not Consumable Fluid Inputs

// Works as .fluidInputs(), but the item doesn't get consumed
.notConsumable(ILiquidStack[])
// examples
.notConsumable(<liquid:aluminium> * 144)
.notConsumable(<liquid:aluminium> * 144, <liquid:water>)

This method takes as many ILiquidStacks as the RecipeMap supports. It makes the fluids specified not consumed when the recipe is run. It counts towards the total fluid input amount.

Energy Usage

// EU per tick
.EUt(int)
// example
.EUt(512)

This method sets the EU usage per tick of the recipe.

Durations

// duration in ticks
.duration(int)
// example
.duration(60)

This method takes an int to determine the recipe's duration in ticks.

Hidden Recipes

// set the recipe to be hidden from JEI
.hidden()

Calling this method makes the recipe hidden in JEI. It cannot be unhidden.

Building and Registering

// build and register the recipe to the RecipeMap
.buildAndRegister()

Builds and Registers the recipe to the RecipeMap. This completes the RecipeBuilder.

Printing

// return the string form the recipe
.toString()

Call this method instead of buildAndRegister() to create the string form of the recipe. It is useful for debugging recipes when printed.

Example

import mods.gregtech.recipe.RecipeMap;

// Brewing Machine
val brewer as RecipeMap = <recipemap:brewery>;

brewer.recipeBuilder()
    .inputs(<ore:ingotWroughtIron>)
    .fluidInputs([<liquid:oxygen> * 500])
    .outputs(<ore:ingotSteel>.firstItem)
    .duration(40) // in ticks, not seconds. 20 ticks per second
    .EUt(120)
    .buildAndRegister();

Item Input NBT

Item inputs with NBT have special behavior. By default, an input with no NBT tag will only accept items with no NBT tag on them.

Inputs with an NBT tag will only accept items that have all of the tags on the input, but will also accept items that have extra tags on top of the requirements.

Inputs with an empty NBT tag will accept any matching item regardless of NBT.

Recipe Properties

Recipe Properties are additional attributes some recipes have, which allow you to specify additional values.

Applying a property to a recipe:

.property(String name, Object value)

The name of the property is used to select which value to add to the recipe. The value is the value being set.

Available Properties:

Name Description
dimension Gas Collector. The dimension ID for the Gas Collector to collect from. Use once per dimension to allow.
eu_to_start Fusion Reactor. The starting EU cost to start Fusion.
explosives Implosion Compressor, amount of explosives or the explosive item
temperature Blast Furnace. Minimum temperature requirement.

Blast Furnace Temperature:

// Set the temperature required to run the recipe. It must be greater than 0.
.property("temperature", int temperature)
// Eu is the EU required to start the fusion recipe. It must be greater than 0.
.property("eu_to_start", int eu)

Some properties take different arguments. The explosives property can be used in two different ways:

 // Amount is the integer amount of explosives required to make a recipe work
 // This will default to using TnT as the explosive for the recipe
.property("explosives", int amount)

// Specify an IItemStack to be treated as an explosive. 
// Only use the explosives property once per recipe.
.property("explosives", IItemStack explosive) 

Gas Collector Dimensions:

// Add a required dimension to the Gas Collector recipe with the specified id.
// Gas Collectors can have multiple dimensions, so this method can be called more than once.
.property("dimension", int dimensionId)

Property Example

import mods.gregtech.recipe.RecipeMap;

// Electric Blast Furnace
val blast_furnace as RecipeMap = <recipemap:electric_blast_furnace>;

blast_furnace.recipeBuilder()
    .inputs(<ore:ingotWroughtIron>)
    .fluidInputs([<liquid:oxygen> * 500])
    .outputs(<ore:ingotTitanium>.firstItem)
    .property("temperature", 1000)
    .duration(40)
    .EUt(120)
    .buildAndRegister();

Finding and Removing Recipes

Removing a recipe is done by recipe instance itself, so you have to find a recipe first.

Example:

val compressor as RecipeMap = <recipemap:compressor>;

// findRecipe(long voltage, IItemStack[] inputs, ILiquidStack[] fluidInputs)
compressor.findRecipe(2, [<minecraft:redstone>], null).remove();

Note the voltage is the actual voltage amount, not the voltage tier number.

The IItemStack[] and ILiquidStack[] arguments must be arrays ([]) unless there are none, in which case null should be used instead.

You can also omit the remove() call, which would then return a Recipe. Note that a Recipe is immutable.

Attempting to call remove() on a recipe that could not be found will result in a NullPointerException. Usually script errors related to recipe removals are because the target recipe could not be found.

You can also clear a recipemap entirely. For example:

import mods.gregtech.recipe.helpers;

helpers.clear(<recipemap:assembler>);

Adding and Removing Generator Recipes

Adding fuels now works the same as normal recipes.
This example adds lava to the semi fluid generator recipe map.

<recipemap:semi_fluid_generator>.recipeBuilder()
    .fluidInputs(<liquid:lava> * 16)
    .duration(2)
    .EUt(32)
    .buildAndRegister();