Last active
July 26, 2020 21:10
-
-
Save eutro/d2b1250bb907ae07ff6961f1043a00c3 to your computer and use it in GitHub Desktop.
Frame your drawers by hand!
This file contains 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.item.IItemStack; | |
import crafttweaker.item.IIngredient; | |
import crafttweaker.data.IData; | |
import crafttweaker.recipes.IRecipeFunction; | |
val framingMaterial as IIngredient = <*>.only(function(stack as IItemStack) as bool { | |
if(!stack.isItemBlock) { | |
return false; | |
} | |
return stack.asBlock().definition.getStateFromMeta(stack.metadata).opaqueCube; | |
}); | |
val customDrawerOut = <storagedrawers:customdrawers>.withTag({ | |
display: { | |
Name: "Frame your drawers by hand!", | |
Lore: [ | |
"Top left: sides", | |
"Top right: trim", | |
"Middle left: front" | |
] | |
}, | |
MatS: { | |
id: "extendedcrafting:storage", | |
Count: 1 as byte, | |
Damage: 4 as short | |
} | |
}); | |
function asData(stack as IItemStack) as IData { | |
return { | |
id: stack.definition.id, | |
Count: 1 as byte, | |
Damage: stack.metadata | |
} as IData; | |
} | |
<ore:handFramedThree>.add(<storagedrawers:customdrawers:*>, | |
<framedcompactdrawers:framed_drawer_controller>, // remove these three if you don't have Framed Compacting Drawers | |
<framedcompactdrawers:framed_compact_drawer>, | |
<framedcompactdrawers:framed_slave>); | |
<ore:handFramed>.addAll(<ore:handFramedThree>); | |
<ore:handFramed>.add(<storagedrawers:customtrim>); | |
for front in [true, false] as bool[] { | |
for trim in [true, false] as bool[] { | |
val ingredients as IIngredient[][] = [ | |
[ | |
framingMaterial.marked("MatS"), | |
trim ? framingMaterial.marked("MatT") : null | |
], | |
[ | |
front ? framingMaterial.marked("MatF") : null, | |
(front ? <ore:handFramedThree> : <ore:handFramed>).marked("drawer") | |
] | |
]; | |
recipes.addShaped( | |
"hand_framing_" + (trim ? "trim_" : "") + (front ? "front_" : "") + "side", | |
customDrawerOut, | |
ingredients, | |
function(out, ins, cInfo) { | |
var tag = {} as IData[string]; | |
for key, stack in ins { | |
if(key != "drawer") { | |
tag[key] = asData(stack); | |
} | |
} | |
val ret as any[any] = tag; | |
return ins.drawer.withTag(ret as IData) * 1; | |
} as IRecipeFunction | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment