Last active
October 27, 2019 19:34
-
-
Save notpeelz/b78036b1de81891b70966f8d27c2608a to your computer and use it in GitHub Desktop.
IE Drill Repair CraftTweaker Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import crafttweaker.recipes.IRecipeFunction; | |
import crafttweaker.item.IIngredient; | |
import crafttweaker.item.IItemStack; | |
static drills as IItemStack[string] = { | |
steel: <immersiveengineering:drillhead:0>, | |
iron: <immersiveengineering:drillhead:1> | |
}; | |
static stats as int[string][string] = { | |
steel: { | |
maxDamage: 10000 | |
}, | |
iron: { | |
maxDamage: 6000 | |
} | |
}; | |
/*************** | |
* Steel * | |
***************/ | |
val steel_ins1 as IIngredient[][] = [ | |
[ | |
drills.steel.only(function(item) { | |
return item.tag.headDamage > 0; | |
}).marked("mark"), | |
metals.steel.ingot.only(function(item) { return item.amount == 1; }) | |
], [ | |
drills.steel.only(function(item) { | |
return item.tag.headDamage > (stats.steel.maxDamage / 4); | |
}).marked("mark"), | |
metals.steel.ingot.only(function(item) { return item.amount == 2; }).transformConsume(2) | |
], [ | |
drills.steel.only(function(item) { | |
return item.tag.headDamage > ((stats.steel.maxDamage / 4) * 2); | |
}).marked("mark"), | |
metals.steel.ingot.only(function(item) { return item.amount == 3; }).transformConsume(3) | |
], [ | |
drills.steel.only(function(item) { | |
return item.tag.headDamage > ((stats.steel.maxDamage / 4) * 3); | |
}).marked("mark"), | |
metals.steel.ingot.only(function(item) { return item.amount >= 4; }).transformConsume(4) | |
] | |
]; | |
val steel_ins2 as IIngredient[][] = [ | |
[ | |
drills.steel.only(function(item) { | |
return item.tag.headDamage > (stats.steel.maxDamage / 4); | |
}).marked("mark"), | |
metals.steel.ingot, | |
metals.steel.ingot | |
], [ | |
drills.steel.only(function(item) { | |
return item.tag.headDamage > ((stats.steel.maxDamage / 4) * 2); | |
}).marked("mark"), | |
metals.steel.ingot, | |
metals.steel.ingot, | |
metals.steel.ingot | |
], [ | |
drills.steel.only(function(item) { | |
return item.tag.headDamage > ((stats.steel.maxDamage / 4) * 3); | |
}).marked("mark"), | |
metals.steel.ingot, | |
metals.steel.ingot, | |
metals.steel.ingot, | |
metals.steel.ingot | |
] | |
]; | |
var steel_fns as IRecipeFunction[] = [ | |
function (out, ins, cInfo) { | |
return ins.mark.withTag(ins.mark.tag + { | |
headDamage: max(0, min(ins.mark.tag.headDamage, stats.steel.maxDamage) - (stats.steel.maxDamage / 4)) | |
}); | |
}, | |
function (out, ins, cInfo) { | |
return ins.mark.withTag(ins.mark.tag + { | |
headDamage: max(0, min(ins.mark.tag.headDamage, stats.steel.maxDamage) - (stats.steel.maxDamage / 4) * 2) | |
}); | |
}, | |
function (out, ins, cInfo) { | |
return ins.mark.withTag(ins.mark.tag + { | |
headDamage: max(0, min(ins.mark.tag.headDamage, stats.steel.maxDamage) - (stats.steel.maxDamage / 4) * 3) | |
}); | |
}, | |
function (out, ins, cInfo) { | |
return ins.mark.withTag(ins.mark.tag + { | |
headDamage: max(0, min(ins.mark.tag.headDamage, stats.steel.maxDamage) - (stats.steel.maxDamage / 4) * 4) | |
}); | |
} | |
]; | |
recipes.addShapeless("drillhead_steel_repair_stack_0", drills.steel, steel_ins1[0], steel_fns[0], null); | |
recipes.addShapeless("drillhead_steel_repair_stack_1", drills.steel, steel_ins1[1], steel_fns[1], null); | |
recipes.addShapeless("drillhead_steel_repair_stack_2", drills.steel, steel_ins1[2], steel_fns[2], null); | |
recipes.addShapeless("drillhead_steel_repair_stack_3", drills.steel, steel_ins1[3], steel_fns[3], null); | |
recipes.addShapeless("drillhead_steel_repair_1", drills.steel, steel_ins2[0], steel_fns[1], null); | |
recipes.addShapeless("drillhead_steel_repair_2", drills.steel, steel_ins2[1], steel_fns[2], null); | |
recipes.addShapeless("drillhead_steel_repair_3", drills.steel, steel_ins2[2], steel_fns[3], null); | |
/*************** | |
* Iron * | |
***************/ | |
val iron_ins1 as IIngredient[][] = [ | |
[ | |
drills.iron.only(function(item) { | |
return item.tag.headDamage > 0; | |
}).marked("mark"), | |
metals.iron.ingot.only(function(item) { return item.amount == 1; }) | |
], [ | |
drills.iron.only(function(item) { | |
return item.tag.headDamage > (stats.iron.maxDamage / 4); | |
}).marked("mark"), | |
metals.iron.ingot.only(function(item) { return item.amount == 2; }).transformConsume(2) | |
], [ | |
drills.iron.only(function(item) { | |
return item.tag.headDamage > ((stats.iron.maxDamage / 4) * 2); | |
}).marked("mark"), | |
metals.iron.ingot.only(function(item) { return item.amount == 3; }).transformConsume(3) | |
], [ | |
drills.iron.only(function(item) { | |
return item.tag.headDamage > ((stats.iron.maxDamage / 4) * 3); | |
}).marked("mark"), | |
metals.iron.ingot.only(function(item) { return item.amount >= 4; }).transformConsume(4) | |
] | |
]; | |
val iron_ins2 as IIngredient[][] = [ | |
[ | |
drills.iron.only(function(item) { | |
return item.tag.headDamage > (stats.iron.maxDamage / 4); | |
}).marked("mark"), | |
metals.iron.ingot, | |
metals.iron.ingot | |
], [ | |
drills.iron.only(function(item) { | |
return item.tag.headDamage > ((stats.iron.maxDamage / 4) * 2); | |
}).marked("mark"), | |
metals.iron.ingot, | |
metals.iron.ingot, | |
metals.iron.ingot | |
], [ | |
drills.iron.only(function(item) { | |
return item.tag.headDamage > ((stats.iron.maxDamage / 4) * 3); | |
}).marked("mark"), | |
metals.iron.ingot, | |
metals.iron.ingot, | |
metals.iron.ingot, | |
metals.iron.ingot | |
] | |
]; | |
var iron_fns as IRecipeFunction[] = [ | |
function (out, ins, cInfo) { | |
return ins.mark.withTag(ins.mark.tag + { | |
headDamage: max(0, min(ins.mark.tag.headDamage, stats.iron.maxDamage) - (stats.iron.maxDamage / 4)) | |
}); | |
}, | |
function (out, ins, cInfo) { | |
return ins.mark.withTag(ins.mark.tag + { | |
headDamage: max(0, min(ins.mark.tag.headDamage, stats.iron.maxDamage) - (stats.iron.maxDamage / 4) * 2) | |
}); | |
}, | |
function (out, ins, cInfo) { | |
return ins.mark.withTag(ins.mark.tag + { | |
headDamage: max(0, min(ins.mark.tag.headDamage, stats.iron.maxDamage) - (stats.iron.maxDamage / 4) * 3) | |
}); | |
}, | |
function (out, ins, cInfo) { | |
return ins.mark.withTag(ins.mark.tag + { | |
headDamage: max(0, min(ins.mark.tag.headDamage, stats.iron.maxDamage) - (stats.iron.maxDamage / 4) * 4) | |
}); | |
} | |
]; | |
recipes.addShapeless("drillhead_iron_repair_stack_0", drills.iron, iron_ins1[0], iron_fns[0], null); | |
recipes.addShapeless("drillhead_iron_repair_stack_1", drills.iron, iron_ins1[1], iron_fns[1], null); | |
recipes.addShapeless("drillhead_iron_repair_stack_2", drills.iron, iron_ins1[2], iron_fns[2], null); | |
recipes.addShapeless("drillhead_iron_repair_stack_3", drills.iron, iron_ins1[3], iron_fns[3], null); | |
recipes.addShapeless("drillhead_iron_repair_1", drills.iron, iron_ins2[0], iron_fns[1], null); | |
recipes.addShapeless("drillhead_iron_repair_2", drills.iron, iron_ins2[1], iron_fns[2], null); | |
recipes.addShapeless("drillhead_iron_repair_3", drills.iron, iron_ins2[2], iron_fns[3], null); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment