-
Notifications
You must be signed in to change notification settings - Fork 7
CraftTweaker Support
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 anIIngredient[]
array variant as well for multi input recipes. -
IItemStack output
: A single outputItemStack
representing one output slot. It may come in anIItemStack[]
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.
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
mods.gregtechmod.AlloySmelter
void addRecipe(IIngredient[] inputs, IItemStack output, int duration, @Optional double energyCost, @Optional boolean universal)
void removeRecipe(IItemStack[] inputs)
mods.gregtechmod.Assembler
void addRecipe(IIngredient[] inputs, IItemStack output, int duration, @Optional double energyCost)
void removeRecipe(IItemStack[] inputs)
mods.gregtechmod.Bender
void addRecipe(IIngredient input, IItemStack output, int duration, double energyCost)
void removeRecipe(IItemStack input)
mods.gregtechmod.Canner
void addRecipe(IIngredient[] inputs, IItemStack[] outputs, int duration, double energyCost)
void removeRecipe(IItemStack[] inputs)
mods.gregtechmod.ChemicalReactor
void addRecipe(IIngredient[] inputs, IItemStack outputs, int duration)
void removeRecipe(IItemStack[] inputs)
mods.gregtechmod.DistillationTower
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)
mods.gregtechmod.FusionReactor
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)
mods.gregtechmod.ImplosionCompressor
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)
mods.gregtechmod.IndustrialBlastFurnace
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)
mods.gregtechmod.IndustrialCentrifuge
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)
mods.gregtechmod.IndustrialElectrolyzer
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)
mods.gregtechmod.IndustrialGrinder
void addRecipe(IIngredient input, ILiquidStack fluid, IItemStack[] output)
void removeRecipe(IItemStack input, ILiquidStack fluid)
mods.gregtechmod.IndustrialSawmill
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)
mods.gregtechmod.Lathe
void addRecipe(IIngredient input, IItemStack[] outputs, int duration, @Optional(valueDouble = RecipeLathe.DEFAULT_ENERGY_COST) double energyCost)
void removeRecipe(IItemStack input)
mods.gregtechmod.Printer
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)
mods.gregtechmod.VacuumFreezer
void addRecipe(IIngredient input, IItemStack output, int duration, double energyCost)
void removeRecipe(IItemStack input)
mods.gregtechmod.Wiremill
void addRecipe(IIngredient input, IItemStack output, int duration, double energyCost)
void removeRecipe(IItemStack input)
Same rules apply as for adding/removing recipes.
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 outputItemStack
.
void addFuel(IIngredient input, double energy, @Optional IItemStack output)
void removeFuel(ILiquidStack fluid)
void removeFuel(IItemStack stack)
mods.gregtechmod.fuel.DenseLiquid
Used in the Semifluid generator.
mods.gregtechmod.fuel.Diesel
Used in the Diesel generator.
mods.gregtechmod.fuel.Gas
Used in Gas turbines.
mods.gregtechmod.fuel.Magic
Used in the Magic Energy Converter.
mods.gregtechmod.fuel.Plasma
Used in the Plasma Generator.
mods.gregtechmod.fuel.Steam
Used in the Large Steam Turbine, as well as the Steam Engine upgrade.
mods.gregtechmod.OreDict
Utility methods for modifying the OreDictHandler
, which is used to generate dynamic recipes.
Alias an oredict entry name.
void addOreAlias(String ore, String alias)
removeOreAlias(String ore)
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)
Exclude an oredict entry from OreDictHandler
.
void addIgnoredName(String ore)
void removeIgnoredName(String ore)
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.
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:
-
IItemStack anyCustomDamage(IItemStack stack)
: Sets the stack's custom damage to the wildcard value -
IItemStack withCustomDamage(IItemStack stack, int damage)
: Sets the stack's custom damage to the specified value
You can find examples for most ZS methods here.