Search in sources :

Example 1 with DistillationTowerRecipe

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

the class CTDistillationTower method addRecipe.

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

Example 2 with DistillationTowerRecipe

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

the class DistillationTowerRecipes 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 number of distillation tower 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 distillation tower outputs: " + outputs + "(Recipe requires > 64 cells)");
        }
        cells = DynamicCell.getEmptyCell(cellCount);
    }
    RecipeHandler.addRecipe(new DistillationTowerRecipe(input, cells, output1, output2, output3, output4, ticks, euPerTick, oreDict));
}
Also used : InvalidParameterException(java.security.InvalidParameterException) DistillationTowerRecipe(techreborn.api.recipe.machines.DistillationTowerRecipe) DynamicCell(techreborn.items.DynamicCell) ItemStack(net.minecraft.item.ItemStack)

Aggregations

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