Search in sources :

Example 1 with IndustrialElectrolyzerRecipe

use of techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe in project TechReborn by TechReborn.

the class CTIndustrialElectrolyzer method addRecipe.

@ZenMethod
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient cells, IIngredient input2, int ticktime, int euTick) {
    Object oInput1 = CraftTweakerCompat.toObject(cells);
    Object oInput2 = CraftTweakerCompat.toObject(input2);
    IndustrialElectrolyzerRecipe r = new IndustrialElectrolyzerRecipe(oInput1, oInput2, CraftTweakerCompat.toStack(output1), CraftTweakerCompat.toStack(output2), CraftTweakerCompat.toStack(output3), CraftTweakerCompat.toStack(output4), ticktime, euTick);
    addRecipe(r);
}
Also used : IndustrialElectrolyzerRecipe(techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Example 2 with IndustrialElectrolyzerRecipe

use of techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe in project TechReborn by TechReborn.

the class IndustrialElectrolyzerRecipes method register.

static void register(ItemStack input, int ticks, int euPerTick, boolean oreDict, ItemStack... outputs) {
    ItemStack output1;
    ItemStack output2 = null;
    ItemStack output3 = null;
    ItemStack output4 = null;
    if (outputs.length == 3) {
        output1 = outputs[0];
        output2 = outputs[1];
        output3 = outputs[2];
    } else if (outputs.length == 2) {
        output1 = outputs[0];
        output2 = outputs[1];
    } else if (outputs.length == 1) {
        output1 = outputs[0];
    } else if (outputs.length == 4) {
        output1 = outputs[0];
        output2 = outputs[1];
        output3 = outputs[2];
        output4 = outputs[3];
    } else {
        throw new InvalidParameterException("Invalid industrial electrolyzer outputs: " + outputs);
    }
    int cellCount = 0;
    for (ItemStack stack : outputs) {
        if (stack.getItem() instanceof DynamicCell) {
            cellCount += stack.getCount();
        }
    }
    if (input.getItem() instanceof DynamicCell) {
        int inputCount = input.getCount();
        if (cellCount < inputCount) {
            if (output2 == null) {
                output2 = DynamicCell.getEmptyCell(inputCount - cellCount);
            } else if (output3 == null) {
                output3 = DynamicCell.getEmptyCell(inputCount - cellCount);
            } else if (output4 == null) {
                output4 = DynamicCell.getEmptyCell(inputCount - cellCount);
            }
        }
        cellCount -= inputCount;
    }
    if (cellCount < 0) {
        cellCount = 0;
    }
    ItemStack cells = null;
    if (cellCount > 0) {
        if (cellCount > 64) {
            throw new InvalidParameterException("Invalid industrial electrolyzer outputs: " + outputs + "(Recipe requires > 64 cells)");
        }
        cells = DynamicCell.getEmptyCell(cellCount);
    }
    RecipeHandler.addRecipe(new IndustrialElectrolyzerRecipe(input, cells, output1, output2, output3, output4, ticks, euPerTick, oreDict));
}
Also used : InvalidParameterException(java.security.InvalidParameterException) DynamicCell(techreborn.items.DynamicCell) ItemStack(net.minecraft.item.ItemStack) IndustrialElectrolyzerRecipe(techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe)

Example 3 with IndustrialElectrolyzerRecipe

use of techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe in project TechReborn by TechReborn.

the class MTIndustrialElectrolyzer method addRecipe.

@ZenMethod
public static void addRecipe(IItemStack output1, IItemStack output2, IItemStack output3, IItemStack output4, IIngredient cells, IIngredient input2, int ticktime, int euTick) {
    ItemStack oInput1 = (ItemStack) MinetweakerCompat.toObject(cells);
    ItemStack oInput2 = (ItemStack) MinetweakerCompat.toObject(input2);
    IndustrialElectrolyzerRecipe r = new IndustrialElectrolyzerRecipe(oInput1, oInput2, MinetweakerCompat.toStack(output1), MinetweakerCompat.toStack(output2), MinetweakerCompat.toStack(output3), MinetweakerCompat.toStack(output4), ticktime, euTick);
    addRecipe(r);
}
Also used : IItemStack(minetweaker.api.item.IItemStack) ItemStack(net.minecraft.item.ItemStack) IndustrialElectrolyzerRecipe(techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Aggregations

IndustrialElectrolyzerRecipe (techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe)3 ItemStack (net.minecraft.item.ItemStack)2 ZenMethod (stanhebben.zenscript.annotations.ZenMethod)2 InvalidParameterException (java.security.InvalidParameterException)1 IItemStack (minetweaker.api.item.IItemStack)1 DynamicCell (techreborn.items.DynamicCell)1