Search in sources :

Example 1 with SolderingStationRecipe

use of logisticspipes.recipes.SolderingStationRecipes.SolderingStationRecipe in project LogisticsPipes by RS485.

the class LogisticsSolderingTileEntity method getHandlerForRecipe.

public ICraftingResultHandler getHandlerForRecipe() {
    for (SolderingStationRecipe recipe : SolderingStationRecipes.getRecipes()) {
        boolean match = true;
        for (int i = 0; i < 9; i++) {
            ItemStack recipestack = recipe.source[i];
            ItemStack inputStack = inv.getStackInSlot(i);
            if (recipestack == null) {
                if (inputStack != null) {
                    match = false;
                }
                continue;
            } else if (inputStack == null) {
                match = false;
                continue;
            } else {
                if (!itemEquals(recipestack, inputStack)) {
                    match = false;
                }
            }
        }
        if (match) {
            return recipe.handler;
        }
    }
    return null;
}
Also used : SolderingStationRecipe(logisticspipes.recipes.SolderingStationRecipes.SolderingStationRecipe) ItemStack(net.minecraft.item.ItemStack)

Example 2 with SolderingStationRecipe

use of logisticspipes.recipes.SolderingStationRecipes.SolderingStationRecipe in project LogisticsPipes by RS485.

the class LogisticsSolderingTileEntity method getTagetForRecipe.

public ItemStack getTagetForRecipe(boolean remove) {
    for (SolderingStationRecipe recipe : SolderingStationRecipes.getRecipes()) {
        boolean match = true;
        boolean removeThis = false;
        for (int i = 0; i < 9; i++) {
            ItemStack recipestack = recipe.source[i];
            ItemStack inputStack = inv.getStackInSlot(i);
            if (recipestack == null) {
                if (inputStack != null) {
                    match = false;
                }
                continue;
            } else if (inputStack == null) {
                match = false;
                continue;
            } else {
                if (!itemEquals(recipestack, inputStack)) {
                    match = false;
                } else {
                    if (remove && ((getTagetForRecipe(false) != null && itemEquals(getTagetForRecipe(false), recipe.result)) || removeThis)) {
                        inputStack.stackSize -= 1;
                        if (inputStack.stackSize <= 0) {
                            inputStack = null;
                        }
                        inv.setInventorySlotContents(i, inputStack);
                        removeThis = true;
                    }
                }
            }
        }
        if (match) {
            return recipe.result.copy();
        }
    }
    return null;
}
Also used : SolderingStationRecipe(logisticspipes.recipes.SolderingStationRecipes.SolderingStationRecipe) ItemStack(net.minecraft.item.ItemStack)

Aggregations

SolderingStationRecipe (logisticspipes.recipes.SolderingStationRecipes.SolderingStationRecipe)2 ItemStack (net.minecraft.item.ItemStack)2