Search in sources :

Example 11 with MachineRecipeInput

use of crazypants.enderio.base.recipe.MachineRecipeInput in project EnderIO by SleepyTrousers.

the class VatRecipe method matchRecipe.

private RecipeMatch matchRecipe(NNList<MachineRecipeInput> recipeInputs) {
    if (!isValid() || recipeInputs == null || recipeInputs.size() < requiredItems + 1) {
        return null;
    }
    FluidStack inputFluid = null;
    RecipeMatch m = new RecipeMatch();
    for (MachineRecipeInput in : recipeInputs) {
        if (in.isFluid()) {
            inputFluid = in.fluid;
        } else {
            m.setRecipeInput(getRecipeInput(in.slotNumber, in.item));
        }
    }
    if (requiredItems == 1) {
        m.r1 = m.r0;
    }
    m.in = inputFluidStacks.get(m.r0, m.r1);
    m.out = outputFluidStacks.get(m.r0, m.r1);
    if (inputFluid != null && inputFluid.containsFluid(m.in)) {
        return m;
    } else {
        return null;
    }
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) MachineRecipeInput(crazypants.enderio.base.recipe.MachineRecipeInput)

Example 12 with MachineRecipeInput

use of crazypants.enderio.base.recipe.MachineRecipeInput in project EnderIO by SleepyTrousers.

the class VanillaSmeltingRecipe method getCompletedResult.

@Override
@Nonnull
public ResultStack[] getCompletedResult(long nextSeed, float chanceMultiplier, @Nonnull NNList<MachineRecipeInput> inputs) {
    ItemStack output = null;
    for (MachineRecipeInput ri : inputs) {
        if (ri != null && Prep.isValid(ri.item) && output == null) {
            output = FurnaceRecipes.instance().getSmeltingResult(ri.item);
        }
    }
    if (output == null) {
        return new ResultStack[0];
    }
    int stackSize = output.getCount();
    ItemStack result = output.copy();
    result.setCount(stackSize * getNumInputs(inputs));
    return new ResultStack[] { new ResultStack(result) };
}
Also used : MachineRecipeInput(crazypants.enderio.base.recipe.MachineRecipeInput) ItemStack(net.minecraft.item.ItemStack) Nonnull(javax.annotation.Nonnull)

Example 13 with MachineRecipeInput

use of crazypants.enderio.base.recipe.MachineRecipeInput in project EnderIO by SleepyTrousers.

the class VanillaSmeltingRecipe method getQuantitiesConsumed.

@Override
@Nonnull
public List<MachineRecipeInput> getQuantitiesConsumed(@Nonnull NNList<MachineRecipeInput> inputs) {
    int consumed = 0;
    List<MachineRecipeInput> result = new ArrayList<MachineRecipeInput>();
    for (MachineRecipeInput ri : inputs) {
        if (ri != null && Prep.isValid(ri.item) && isValidInput(new MachineRecipeInput(ri.slotNumber, ri.item)) && consumed < 3) {
            int available = ri.item.getCount();
            int canUse = 3 - consumed;
            int use = Math.min(canUse, available);
            if (use > 0) {
                ItemStack st = ri.item.copy();
                st.setCount(use);
                result.add(new MachineRecipeInput(ri.slotNumber, st));
                consumed += use;
            }
        }
    }
    return result;
}
Also used : MachineRecipeInput(crazypants.enderio.base.recipe.MachineRecipeInput) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) Nonnull(javax.annotation.Nonnull)

Example 14 with MachineRecipeInput

use of crazypants.enderio.base.recipe.MachineRecipeInput in project EnderIO by SleepyTrousers.

the class EnchanterRecipe method getQuantitiesConsumed.

@Override
@Nonnull
public NNList<MachineRecipeInput> getQuantitiesConsumed(@Nonnull NNList<MachineRecipeInput> inputs) {
    ItemStack slot0 = MachineRecipeInput.getInputForSlot(0, inputs).copy();
    ItemStack slot1 = MachineRecipeInput.getInputForSlot(1, inputs).copy();
    ItemStack slot2 = MachineRecipeInput.getInputForSlot(2, inputs).copy();
    int level = getLevelForStackSize(slot1.getCount());
    slot0.setCount(1);
    slot1.setCount(stackSizePerLevel * level);
    slot2.setCount(getLapizForLevel(level));
    NNList<MachineRecipeInput> result = new NNList<MachineRecipeInput>();
    result.add(new MachineRecipeInput(0, slot0));
    result.add(new MachineRecipeInput(1, slot1));
    result.add(new MachineRecipeInput(2, slot2));
    return result;
}
Also used : NNList(com.enderio.core.common.util.NNList) MachineRecipeInput(crazypants.enderio.base.recipe.MachineRecipeInput) ItemStack(net.minecraft.item.ItemStack) Nonnull(javax.annotation.Nonnull)

Aggregations

MachineRecipeInput (crazypants.enderio.base.recipe.MachineRecipeInput)14 ItemStack (net.minecraft.item.ItemStack)9 Nonnull (javax.annotation.Nonnull)8 NNList (com.enderio.core.common.util.NNList)5 IMachineRecipe (crazypants.enderio.base.recipe.IMachineRecipe)2 ArrayList (java.util.ArrayList)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 NBTTagList (net.minecraft.nbt.NBTTagList)2 FluidStack (net.minecraftforge.fluids.FluidStack)2 GhostBackgroundItemSlot (com.enderio.core.client.gui.widget.GhostBackgroundItemSlot)1 GhostSlot (com.enderio.core.client.gui.widget.GhostSlot)1 IPoweredTask (crazypants.enderio.base.machine.interfaces.IPoweredTask)1 EnchanterRecipe (crazypants.enderio.base.recipe.enchanter.EnchanterRecipe)1 CapturedMob (crazypants.enderio.util.CapturedMob)1 List (java.util.List)1 Nullable (javax.annotation.Nullable)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 Slot (net.minecraft.inventory.Slot)1