Search in sources :

Example 6 with IPoweredTask

use of crazypants.enderio.base.machine.interfaces.IPoweredTask in project EnderIO by SleepyTrousers.

the class TileAlloySmelter method canStartNextTask.

@Override
protected IMachineRecipe canStartNextTask(long nextSeed) {
    if (getMode() == Mode.FURNACE) {
        VanillaSmeltingRecipe vr = AlloyRecipeManager.getInstance().getVanillaRecipe();
        if (vr.isRecipe(getRecipeInputs())) {
            final IPoweredTask task = createTask(vr, nextSeed);
            if (task == null) {
                return null;
            }
            IMachineRecipe.ResultStack[] res = task.getCompletedResult();
            if (res.length == 0) {
                return null;
            }
            return canInsertResult(nextSeed, vr) ? vr : null;
        }
        return null;
    }
    IMachineRecipe nextRecipe = getNextRecipe();
    if (getMode() == Mode.ALLOY && nextRecipe instanceof VanillaSmeltingRecipe) {
        nextRecipe = null;
    }
    if (nextRecipe == null) {
        // no template
        return null;
    }
    // make sure we have room for the next output
    return canInsertResult(nextSeed, nextRecipe) ? nextRecipe : null;
}
Also used : IPoweredTask(crazypants.enderio.base.machine.interfaces.IPoweredTask) VanillaSmeltingRecipe(crazypants.enderio.base.recipe.alloysmelter.VanillaSmeltingRecipe) IMachineRecipe(crazypants.enderio.base.recipe.IMachineRecipe)

Aggregations

IPoweredTask (crazypants.enderio.base.machine.interfaces.IPoweredTask)6 PoweredTask (crazypants.enderio.base.machine.task.PoweredTask)2 IMachineRecipe (crazypants.enderio.base.recipe.IMachineRecipe)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 NNList (com.enderio.core.common.util.NNList)1 ResultStack (crazypants.enderio.base.recipe.IMachineRecipe.ResultStack)1 MachineRecipeInput (crazypants.enderio.base.recipe.MachineRecipeInput)1 VanillaSmeltingRecipe (crazypants.enderio.base.recipe.alloysmelter.VanillaSmeltingRecipe)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 Nullable (javax.annotation.Nullable)1 ItemStack (net.minecraft.item.ItemStack)1 NBTTagList (net.minecraft.nbt.NBTTagList)1