CraftTweaker

CraftTweaker

151M Downloads

[Help] Nested array and furnace recipes

Smartaros opened this issue ยท 2 comments

commented

val IronDusts = [a, b, c, d] as IItemStack[];
val GoldDusts = [x, y, z] as IItemStack[];
val Dusts = [IronDusts, GoldDusts] as IItemStack[][];
val Nuggets = [iron, gold] as IItemStack[];

I need something like this:
for i, item in Nuggets
{
furnace.addRecipe(item, Dusts[i][each item])
}

commented

Do a nested for-loop (a forloop in a for-loop)
Also, please use the Crafttweaker discord for help with scripts, it's more likely for you to receive an answer there.

val IronDusts = [a, b, c, d] as IItemStack[];
val GoldDusts = [x, y, z] as IItemStack[];
val Dusts = [IronDusts, GoldDusts] as IItemStack[][];
val Nuggets = [iron, gold] as IItemStack[];

for i, item in Nuggets {
    for dust in Dusts[i] {
        recipes.addRecipe(item, dust);
    }
}
commented

Ok, thx