Skip to content

Crafttweaker Machine Recipes

pWn3d1337 edited this page Sep 25, 2024 · 12 revisions

All machines from techguns support adding/removing recipes with crafttweaker. (If it does not work make sure you have Techguns version 2.0.1.2 or newer)

All exposed methods can be viewed in the respective class in https://github.com/pWn3d1337/Techguns2/tree/master/src/main/java/techguns/plugins/crafttweaker All methods annotated with @ZenMethod can be called from crafttweaker scripts.

Example Machine scripts:
import mods.techguns.AmmoPress;
import mods.techguns.ChargingStation;
import mods.techguns.MetalPress;
import mods.techguns.ChemLab;
import mods.techguns.Fabricator;
import mods.techguns.ReactionChamber;
import mods.techguns.BlastFurnace;
import crafttweaker.item.IItemStack;

// add all logWood oredictionary entries as powder for the ammo press
AmmoPress.addPowder(<ore:logWood>);

// remove iron as valid metal for metal slot 2 of the ammo press
AmmoPress.removeMetal2(<ore:ingotIron>);

// Add a recipe to the charging station to charge gunpowder into redstone
ChargingStation.addRecipe(<minecraft:gunpowder>,<minecraft:redstone>,1000);

// Charge logs into nether stars with 100k rf
ChargingStation.addRecipe("logWood",<minecraft:nether_star>,100000);

// remove that gunpowder recipe from above
ChargingStation.removeRecipe("itemGunpowder");

//Press 2 logs into 12 planks, swap-slots is 'false' because two times the same input
MetalPress.addRecipe("logWood","logWood",<minecraft:planks> * 12,false);

//press gunpowder + glass blocks into 3 planks, swapping allowed
MetalPress.addRecipe(<minecraft:gunpowder>,"blockGlass",<minecraft:planks>*3,true);

// remove that recipe from above
MetalPress.removeRecipe(<minecraft:gunpowder>,"blockGlass",<minecraft:planks>);

// remove all recipe resulting in techguns:itemshared:47
MetalPress.removeRecipe(<techguns:itemshared:47>);

//add a recipe for 2 gunpowder + 1 planks + 250mb Lava -> 7 coal, 1000mB Water, 17RF/tick cost
//NOTE: the stack sizes for IItemStacks are ignored for inputs here, because amount is passed as own parameter because oredict strings are allowed too
ChemLab.addRecipe(<minecraft:gunpowder>*5,2,<minecraft:planks>*3,1,<liquid:lava>*250,false,<minecraft:coal>*7,<liquid:water>*1000,17);

ChemLab.addRecipe(<minecraft:gunpowder>*5,2,<minecraft:dirt>,0,<liquid:lava>*250,false,null,<liquid:water>*1000,17);

ChemLab.addRecipe(<minecraft:redstone>*5,2,"logWood",1,<liquid:lava>*250,false,<minecraft:coal>*7,<liquid:water>*0,17); // NOTE: crafttweaker does not like a null fluid stack here, so passing liquid:water*0 (or any other liquid with amount 0 can be used instead). A liquid with amount 0 will be set to null in the recipe.

//remove recipes resulting in water in no item, remove recipes resulting in leather and no liquid
ChemLab.removeRecipe(null,<liquid:water>);
ChemLab.removeRecipe(<minecraft:leather>,null);

//add fabricator recipes, IItemStack amounts for inputs are ignored like for chemlab
Fabricator.addRecipe(<minecraft:gunpowder>*5,1, <minecraft:planks>*5,3, <minecraft:coal:0>,1, "logWood",2, <minecraft:diamond>*2);
Fabricator.addRecipe("ingotGold",1, "itemGunpowder",3, <minecraft:coal:0>,1, "dustRedstone",2, <minecraft:diamond>*2);

//remove recipe for specific output
Fabricator.removeRecipe(<techguns:itemshared:108>);

//outputs must be defined as array for ReactionChamber
var outputs = [<minecraft:log>] as IItemStack[];
ReactionChamber.addRecipe("planks",<minecraft:planks>,<liquid:water>,outputs,<techguns:itemshared:104>,5, 3, 7, 2, 4, 1000,0.0, "EXPLOSION_LOW", 25000);

// remove recipe for specific inputs
ReactionChamber.removeRecipe(<minecraft:nether_star>, <liquid:ender>);

//add recipe to Blast Furnace with 20 power per tick, taking 800 ticks in total
//inputs can be "Oredictname", amount or an <ItemStack>, output must be an itemstack
BlastFurnace.addRecipe("itemGunpowder", 1, <minecraft:planks>*1, <minecraft:diamond>, 20, 800);

// remove recipe from Blast Furnace with specific output
BlastFurnace.removeRecipe(<minecraft:diamond>);

Clone this wiki locally