Skip to content

CraftTweaker Support

TheDarkDnKTv edited this page May 7, 2022 · 1 revision

From version 4.16.40 we implemented CraftTweaker support (MineTweaker3)

Machine Recipes

For now CT integration supports full recipes change, to use it you need to get familiar with GT recipe sst

CraftTweaker classes

Name Package Description
RecipeMaps mods.gregtechmod.recipe.RecipeMaps Contains all GT recipe maps
RecipeMap mods.gregtechmod.recipe.RecipeMap Unified Object that contains all recipes and logic for searching of them
Recipe mods.gregtechmod.recipe.Recipe Unified Object represent a machine recipe. All inputs, outputs, chances, energy and time
RecipeFactory mods.gregtechmod.recipe.RecipeFactory Helps to create new Recipe instance and register it
Ingredient mods.gregtechmod.recipe.Ingredient Represents ingredient of recipe inputs (contains count and item variatns that suits)
ChancedOutput mods.gregtechmod.recipe.ChancedOutput Represents output that is result of chance

Classes documentation

Full documentation of CT classes

RecipeMaps

Methods

Type Description
getRecipeMap(mapName: String): RecipeMap Will provide you with specified RecipeMap instance

Available Recipe Maps

Information about inputs/outputs limit can bee seen in code here in order of (minInputs, maxInputs, minOutputs, maxOutputs, minFluidInputs, maxFluidInputs, minFluidOutputs, maxFluidOutputs)

Name
FUSION_REACTOR
CENTRIFUGE
ELECTROLYZER
GRINDER
BLAST_FURNACE
BRONZE_BLAST_FURNACE
IMPLOSION_COMPRESSOR
SAWMILL
VACUUM_FREEZER
CHEMICAL
DISTILLATION
WIREMILL
BENDING
ALLOY_SMELTING
ASSEMBLING
CANNING
LATHE
CUTTING
EXTRUDING
HAMMER
PRINTER
PULVERIZING
DIESEL_FUELS
TURBINE_FUELS
HOT_FUELS
DENSE_FUELS
PLASMA_FUELS
MAGIC_FUELS
STEAM_FUELS

Example of usage

val BENDING = RecipeMaps.getRecipeMap("BENDING");

RecipeMap

Methods

Signature Description
getRecipes(): Recipe[] Get all recipes of RecipeMap
findRecipe(items: IItemStack[], fluids: ILiquidStack[]): Recipe Find recipe that matches by selected items, and fluids. Recipe can be null (void)
register(recipe: Recipe): boolean Register recipe for this RecipeMap, will return true if registered
remove(recipe: Recipe): boolean Remove recipe from this RecipeMap, will return true if removed (Null input safe)
factory(): RecipeFactory Return RecipeFactory instance

Getters

Signature
int minInputs
int maxInputs
int minOutputs
int maxOutputs
int minFluidInputs
int maxFluidInputs
int minFluidOutputs
int maxFluidOutputs

RecipeFactory

Methods

Signature Description
EUt(amount: int): RecipeBuilder EU/t
duration(ticks: int): RecipeBuilder Duration in ticks
startEU(amount: int): RecipeBuilder EU to start, will be consumed only from initial machine start (if was running, will not)
setShaped(value: boolean): RecipeBuilder Shaped - it means that inputs should be in same order as in recipe
circuit(config: int): RecipeBuilder Will add integrated circuit as non consumable at recipe input with specified config number
nonConsumable(item: IItemStack): RecipeBuilder Non consumable input
input(item: IIngredient): RecipeBuilder
inputs(items...IIngredient): RecipeBuilder
fluidInput(fluid: ILiquidStack): RecipeBuilder
fluidInputs(fluids...ILiquidStack): RecipeBuilder
output(item: IItemStack): RecipeBuilder
outputs(items...IItemStack): RecipeBuilder
chancedOutput(item: IItemStack, chance: int): RecipeBuilder Chance are specified in number from [0-10000], where 75_16 means 75.16%
fluidOutput(fluid: ILiquidStack): RecipeBuilder
fluidOutputs(fluids...ILiquidStack): RecipeBuilder
withMeta(key: String, value: int): RecipeBuilder Recipe metadata required for some machines, like ElectricBlast Furnace
build(): Recipe Will create Recipe instance
buildAndRegister(): void Will create Recipe and register it on recipe map of this builder

Ingredient

Getters

Signature
int count
IItemStack[] variants

ChancedOutput

Getters

Signature
int chance
IItemStack stack

Recipe

Methods

Signature Description
getMeta(key: String): Object Will return recipe meta value
getAllOutputs(): IItemStack[] Get all possible recipe item outputs (chanced + usual)

Getters

Signature Description
int EUt
int duration
int startEU
boolean shaped
boolean fluidRecipe true if recipe inputs/outputs contains fluid
String[] metaKeys All set meta keys of this recipe
Ingredient[] inputs
IItemStack[] outputs
ChancedOutput[] chancedOutputs
ILiquidStack[] fluidInputs
ILiquidStack[] fluidOutputs

Usage examples

Basic Recipe add

val LATHE_RECIPES = RecipeMaps.getRecipeMap("LATHE") as RecipeMap;
LATHE_RECIPES.factory()
	.EUt(1)
	.duration(1)
	.input(<minecraft:dirt>)
	.circuit(3)
	.output(<minecraft:diamond>)
	.buildAndRegister();

Electric Blast Furnace recipe add

RecipeMaps.getRecipeMap("BLAST_FURNACE").factory()
	.EUt(15)
	.duration(60)
	.input(<minecraft:dirt>)
	.output(<minecraft:diamond>)
	.withMeta("minTemp", 750)
	.buildAndRegister();

Fuels add

var factory = RecipeMaps.getRecipeMap("MAGIC_FUELS").factory() as RecipeFactory; // you can store factory in variable as well

factory.EUt(7);
factory.duration(100);
factory.input(<minecraft:blaze_rod> * 2);
factory.buildAndRegister();

Recipe Removal

val BENDING = RecipeMaps.getRecipeMap("BENDING") as RecipeMap;
var recipe = BENDING.findRecipe([<IC2:itemIngot:4>, <gregtech_addon:integrated_circuit:1>], []);
BENDING.remove(recipe); // null safe

Remove all recipes

val LATHE_RECIPES= RecipeMaps.getRecipeMap("lathe") as RecipeMap;
for recipe in LATHE_RECIPES.getRecipes() {
    LATHE_RECIPES.remove(recipe);
}