Skip to content

CraftTweaker Support

Su5eD edited this page Sep 15, 2022 · 4 revisions

Recipes

Each recipe support class contains methods for adding and removing recipes, including variants with optional parameters. A lot of parameter types are resused so I'll briefly explain the common ones to avoid duplicate docs:

  • IIngredient input: A single ingredient representing one input slot. It may come in an IIngredient[] array variant as well for multi input recipes.
  • IItemStack output: A single output ItemStack representing one output slot. It may come in an IItemStack[] array variant as well for multi output recipes.
  • int duration: The time it takes to process the recipe in ticks.
  • double energyCost: The recipe's EU/t energy cost.
  • boolean universal: Add this recipe to similar machines from other mods as well.

Removing recipes (and fuels)

I mean, you can only remove things once they're registered, right?

While adding recipes doesn't require any additional configuration, removing them needs to be handled separately.
It's very important you use the gregtechmod loader for removing recipes. This loader only loads the script after GTE finished registering all of its recipes in post-init. You can apply it to your script by using the loader preprocessor:

#loader gregtechmod

Detailed recipe Zen Class usage

Alloy Smelter

mods.gregtechmod.AlloySmelter

Methods

void addRecipe(IIngredient[] inputs, IItemStack output, int duration, @Optional double energyCost, @Optional boolean universal)
void removeRecipe(IItemStack[] inputs)

Assembler

mods.gregtechmod.Assembler

Methods

void addRecipe(IIngredient[] inputs, IItemStack output, int duration, @Optional double energyCost)
void removeRecipe(IItemStack[] inputs)

Bending Machine

mods.gregtechmod.Bender

Methods

void addRecipe(IIngredient input, IItemStack output, int duration, double energyCost)
void removeRecipe(IItemStack input)

Automatic Canning Machine

mods.gregtechmod.Canner

Methods

void addRecipe(IIngredient[] inputs, IItemStack[] outputs, int duration, double energyCost)
void removeRecipe(IItemStack[] inputs)

Chemical Reactor

mods.gregtechmod.ChemicalReactor

Methods

void addRecipe(IIngredient[] inputs, IItemStack outputs, int duration)
void removeRecipe(IItemStack[] inputs)

Distillation Tower

mods.gregtechmod.DistillationTower

Methods

Parameter int cells: The amount of cells required for processing the recipe.

void addRecipe(IIngredient input, IItemStack[] outputs, int cells, int duration)
void removeRecipe(ILiquidStack input)
void removeRecipe(ILiquidStack input, int cells)
void removeRecipe(IItemStack input)
void removeRecipe(IItemStack input, int cells)

Fusion Reactor

mods.gregtechmod.FusionReactor

Methods

Parameter double startEnergy: The amount of EU required to start the reactor. Subsequent processing of the same recipe does not require it.

void addRecipe(IIngredient[] inputs, ILiquidStack output, int duration, double energyCost, double startEnergy)
void addRecipe(IIngredient[] inputs, IItemStack output, int duration, double energyCost, double startEnergy)
void removeRecipe(ILiquidStack[] inputs)
void removeRecipe(ILiquidStack[] inputs)

Implosion Compressor

mods.gregtechmod.ImplosionCompressor

Methods

Parameter int tnt: The amount of Industrial TNT required to process the recipe.

void addRecipe(IIngredient input, int tnt, IItemStack[] outputs)
void removeRecipe(IItemStack input, int tnt)

Industrial Blast Furnace

mods.gregtechmod.IndustrialBlastFurnace

Methods

Parameter int heat: The required amount of Blast Furnace heat capacity to process the recipe.

void addRecipe(IIngredient[] inputs, IItemStack[] outputs, int duration, int heat, @Optional boolean universal)
void addRecipe(IIngredient[] inputs, IItemStack[] outputs, int duration, double energyCost, int heat, @Optional boolean universal)
void removeRecipe(IItemStack[] inputs)

Industrial Centrifuge

mods.gregtechmod.IndustrialCentrifuge

Methods

Parameter int cells: The amount of cells required to process the recipe.

void addRecipe(IIngredient input, IItemStack[] outputs, int cells, int duration, @Optional CTCellType cellType)
void removeRecipe(ILiquidStack input)
void removeRecipe(ILiquidStack input, int cells)
void removeRecipe(IItemStack input)
void removeRecipe(IItemStack input, int cells)

Industrial Electrolyzer

mods.gregtechmod.IndustrialElectrolyzer

Methods

Parameter int cells: The amount of cells required to process the recipe.

void addRecipe(IIngredient input, IItemStack[] outputs, int cells, int duration, @Optional(valueDouble = 128) double energyCost)
void removeRecipe(ILiquidStack input)
void removeRecipe(ILiquidStack input, int cells)
void removeRecipe(IItemStack input)
void removeRecipe(IItemStack input, int cells)

Industrial Grinder

mods.gregtechmod.IndustrialGrinder

Methods

void addRecipe(IIngredient input, ILiquidStack fluid, IItemStack[] output)
void removeRecipe(IItemStack input, ILiquidStack fluid)

Industrial Sawmill

mods.gregtechmod.IndustrialSawmill

Methods

Parameter int water: Buckets of water required to process the recipe.

void addRecipe(IIngredient input, IItemStack[] outputs, @Optional int water, @Optional boolean universal)
void removeRecipe(IItemStack input, ILiquidStack fluid)

Lathe

mods.gregtechmod.Lathe

Methods

void addRecipe(IIngredient input, IItemStack[] outputs, int duration, @Optional(valueDouble = RecipeLathe.DEFAULT_ENERGY_COST) double energyCost)
void removeRecipe(IItemStack input)

Printer

mods.gregtechmod.Printer

Methods

void addRecipe(IIngredient[] inputs, IItemStack output, int duration, @Optional double energyCost)
void addRecipe(IIngredient[] inputs, @Nullable IIngredient copy, IItemStack output, int duration, @Optional double energyCost)
void removeRecipe(IItemStack[] inputs)

Vacuum Freezer

mods.gregtechmod.VacuumFreezer

Methods

void addRecipe(IIngredient input, IItemStack output, int duration, double energyCost)
void removeRecipe(IItemStack input)

Wiremill

mods.gregtechmod.Wiremill

Methods

void addRecipe(IIngredient input, IItemStack output, int duration, double energyCost)
void removeRecipe(IItemStack input)

Fuels

Same rules apply as for adding/removing recipes.

Methods

Parameters:

  • IIngredient input: The fuel input. May be an item and/or fluid depending on the fuel type.
  • double energy: The EU generated by this fuel per tick.
  • IItemStack output: Optional output ItemStack.
void addFuel(IIngredient input, double energy, @Optional IItemStack output)
void removeFuel(ILiquidStack fluid)
void removeFuel(IItemStack stack)

Detailed fuel Zen Class usage

Dense Liquid

mods.gregtechmod.fuel.DenseLiquid

Used in the Semifluid generator.

Diesel

mods.gregtechmod.fuel.Diesel

Used in the Diesel generator.

Gas

mods.gregtechmod.fuel.Gas

Used in Gas turbines.

Magic

mods.gregtechmod.fuel.Magic

Used in the Magic Energy Converter.

Plasma

mods.gregtechmod.fuel.Plasma

Used in the Plasma Generator.

Steam

mods.gregtechmod.fuel.Steam

Used in the Large Steam Turbine, as well as the Steam Engine upgrade.

OreDict

mods.gregtechmod.OreDict

Utility methods for modifying the OreDictHandler, which is used to generate dynamic recipes.

Detailed oredict Zen methods usage

Ore Aliases

Alias an oredict entry name.

void addOreAlias(String ore, String alias)
removeOreAlias(String ore)

Valuable Ores

Modify values in IC2's OreValues class, which are then used in the Miner and ore Scanner.

void addValuableOre(String ore, int value)
void removeValuableOre(String ore)

Ignored names

Exclude an oredict entry from OreDictHandler.

void addIgnoredName(String ore)
void removeIgnoredName(String ore)

Zen Utilities

Fluid Cell Bracket Handler

GTE adds a custom bracket handler that returns a fluid cell IItemStack for the current IC2 profile. You can use it by calling <fluid_cell:fluid_name>, where fluid_name is the name of the desired fluid.

Custom damage setter

Items that implement ICustomDamageItem (electric items, reactor coolant cells etc.) have a separate way of handling item damage and traditional methods such as setItemDamage don't have any effect on them. Instead, you need to call interface specific methods. For this purpose, GTE extends IItemStack with 2 new functions:

  1. IItemStack anyCustomDamage(IItemStack stack): Sets the stack's custom damage to the wildcard value
  2. IItemStack withCustomDamage(IItemStack stack, int damage): Sets the stack's custom damage to the specified value

Examples!

Because we love examples.

You can find examples for most ZS methods here.