Package buildcraft.transport.recipes

Source Code of buildcraft.transport.recipes.IntegrationTableRecipe

/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.transport.recipes;

import net.minecraft.item.ItemStack;

import buildcraft.api.recipes.CraftingResult;
import buildcraft.api.recipes.IFlexibleCrafter;
import buildcraft.api.recipes.IIntegrationRecipe;
import buildcraft.core.recipes.FlexibleRecipe;
import buildcraft.silicon.TileIntegrationTable;

public abstract class IntegrationTableRecipe extends FlexibleRecipe<ItemStack> implements IIntegrationRecipe {

  @Override
  public final CraftingResult<ItemStack> craft(IFlexibleCrafter crafter, boolean preview) {
    TileIntegrationTable table = (TileIntegrationTable) crafter;

    ItemStack inputA;
    ItemStack inputB;

    if (preview) {
      inputA = table.getStackInSlot(TileIntegrationTable.SLOT_INPUT_A);
      inputB = table.getStackInSlot(TileIntegrationTable.SLOT_INPUT_B);

      if (inputA != null) {
        inputA = inputA.copy();
      }

      if (inputB != null) {
        inputB = inputB.copy();
      }
    } else {
      inputA = table.decrStackSize(TileIntegrationTable.SLOT_INPUT_A, 1);
      inputB = table.decrStackSize(TileIntegrationTable.SLOT_INPUT_B, 1);
    }

    return craft(table, preview, inputA, inputB);
  }

  public CraftingResult<ItemStack> craft(TileIntegrationTable crafter, boolean preview, ItemStack inputA,
      ItemStack inputB) {
    return super.craft(crafter, preview);
  }

  @Override
  public CraftingResult canCraft(ItemStack expectedOutput) {
    return null;
  }
}
TOP

Related Classes of buildcraft.transport.recipes.IntegrationTableRecipe

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.