Search in sources :

Example 1 with ICraftingResultHandler

use of logisticspipes.interfaces.ICraftingResultHandler in project LogisticsPipes by RS485.

the class LogisticsSolderingTileEntity method tryCraft.

private boolean tryCraft() {
    ItemIdentifierStack content = inv.getIDStackInSlot(10);
    ICraftingResultHandler handler = getHandlerForRecipe();
    ItemStack toAdd = getTagetForRecipe(false);
    if (handler != null) {
        handler.handleCrafting(toAdd);
    }
    if (content != null) {
        if (!content.getItem().equals(toAdd)) {
            return false;
        }
        if (content.getStackSize() + toAdd.stackSize > content.getItem().getMaxStackSize()) {
            return false;
        }
        toAdd.stackSize += content.getStackSize();
    }
    //dummy
    getTagetForRecipe(true);
    inv.setInventorySlotContents(10, toAdd);
    inv.decrStackSize(9, 1);
    inv.markDirty();
    super.markDirty();
    updateInventory();
    return true;
}
Also used : ICraftingResultHandler(logisticspipes.interfaces.ICraftingResultHandler) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ICraftingResultHandler (logisticspipes.interfaces.ICraftingResultHandler)1 ItemIdentifierStack (logisticspipes.utils.item.ItemIdentifierStack)1 ItemStack (net.minecraft.item.ItemStack)1