Skip to content

Instantly share code, notes, and snippets.

@Lgmrszd
Last active October 26, 2023 19:59
Show Gist options
  • Save Lgmrszd/0eb186268a82eda0af073785814f15ee to your computer and use it in GitHub Desktop.
Save Lgmrszd/0eb186268a82eda0af073785814f15ee to your computer and use it in GitHub Desktop.
Example CT script for creating GT tools using artisan worktables
import mods.artisanworktables.builder.RecipeBuilder;
val materials = ["WroughtIron", "Steel", "Aluminium", "Bronze", "BlackSteel"] as string[];
function toSnakeCase(inp as string) as string{
val regex = "([a-z])([A-Z]+)";
val replacement = "$1_$2";
return inp.replaceAll(regex, replacement).toLowerCase();
}
for mat in materials {
val mat2 = toSnakeCase(mat);
val rod = oreDict.get("stick" + mat);
val tool = <gregtech:meta_tool:11>.withTag({"GT.ToolStats": {Material: mat2}});
RecipeBuilder.get("blacksmith")
.setShaped([
[null, null, rod],
[<ore:plankWood>, rod, null],
[<ore:plankWood>, <ore:plankWood>, null]])
.setFluid(<liquid:glue> * 100)
.addTool(<ore:artisansChisel>, 20)
.addTool(<ore:artisansFile>, 30)
.addOutput(tool)
.setName("gt_screwdriver_"+mat2)
.create();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment