From edf8f17a6f568b7ed4661a5975f3eee1c4859d52 Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Sat, 28 Dec 2013 01:24:18 -0800 Subject: [PATCH] Add Integration Table Recipe API --- common/buildcraft/BuildCraftCore.java | 2 + .../api/recipes/BuildcraftRecipes.java | 1 + .../recipes/IIntegrationRecipeManager.java | 41 +++++++++++++++++++ .../recipes/IntegrationRecipeManager.java | 22 ++++++++++ .../silicon/TileIntegrationTable.java | 26 ++++++++++++ 5 files changed, 92 insertions(+) create mode 100644 common/buildcraft/api/recipes/IIntegrationRecipeManager.java create mode 100644 common/buildcraft/core/recipes/IntegrationRecipeManager.java create mode 100644 common/buildcraft/silicon/TileIntegrationTable.java diff --git a/common/buildcraft/BuildCraftCore.java b/common/buildcraft/BuildCraftCore.java index 2c98d640c3..ce791129fc 100644 --- a/common/buildcraft/BuildCraftCore.java +++ b/common/buildcraft/BuildCraftCore.java @@ -66,6 +66,7 @@ import buildcraft.core.utils.BCLog; import buildcraft.core.utils.Localization; import buildcraft.core.recipes.AssemblyRecipeManager; +import buildcraft.core.recipes.IntegrationRecipeManager; import buildcraft.core.triggers.TriggerRedstoneInput; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; @@ -156,6 +157,7 @@ public void loadConfiguration(FMLPreInitializationEvent evt) { BCLog.initLog(); BuildcraftRecipes.assemblyTable = AssemblyRecipeManager.INSTANCE; + BuildcraftRecipes.integrationTable = IntegrationRecipeManager.INSTANCE; BuildcraftRecipes.refinery = RefineryRecipeManager.INSTANCE; mainConfiguration = new BuildCraftConfiguration(new File(evt.getModConfigurationDirectory(), "buildcraft/main.conf")); diff --git a/common/buildcraft/api/recipes/BuildcraftRecipes.java b/common/buildcraft/api/recipes/BuildcraftRecipes.java index c6e6bdc1b7..57f7e092cd 100644 --- a/common/buildcraft/api/recipes/BuildcraftRecipes.java +++ b/common/buildcraft/api/recipes/BuildcraftRecipes.java @@ -15,6 +15,7 @@ public final class BuildcraftRecipes { public static IAssemblyRecipeManager assemblyTable; + public static IIntegrationRecipeManager integrationTable; public static IRefineryRecipeManager refinery; private BuildcraftRecipes() { diff --git a/common/buildcraft/api/recipes/IIntegrationRecipeManager.java b/common/buildcraft/api/recipes/IIntegrationRecipeManager.java new file mode 100644 index 0000000000..6c325158cf --- /dev/null +++ b/common/buildcraft/api/recipes/IIntegrationRecipeManager.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) SpaceToad, 2011-2012 + * 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.api.recipes; + +import java.util.List; +import net.minecraft.item.ItemStack; + +/** + * The Integration Table's primary purpose is to modify an input item's NBT + * data. As such its not a "traditional" type of recipe. Rather than predefined + * inputs and outputs, it takes an input and transforms it. + * + * @author CovertJaguar + */ +public interface IIntegrationRecipeManager { + + public static interface IIntegrationRecipe { + + double getEnergyCost(); + + boolean isValidInput(ItemStack stack); + + ItemStack getOutputForInput(ItemStack stack); + + ItemStack[] getExampleInputs(); + } + + /** + * Add an Integration Table recipe. + * + */ + void addRecipe(IIntegrationRecipe recipe); + + List getRecipes(); +} diff --git a/common/buildcraft/core/recipes/IntegrationRecipeManager.java b/common/buildcraft/core/recipes/IntegrationRecipeManager.java new file mode 100644 index 0000000000..f2faa0d693 --- /dev/null +++ b/common/buildcraft/core/recipes/IntegrationRecipeManager.java @@ -0,0 +1,22 @@ +package buildcraft.core.recipes; + +import buildcraft.api.recipes.IIntegrationRecipeManager; +import buildcraft.api.recipes.IIntegrationRecipeManager.IIntegrationRecipe; +import java.util.LinkedList; +import java.util.List; + +public class IntegrationRecipeManager implements IIntegrationRecipeManager { + + public static final IntegrationRecipeManager INSTANCE = new IntegrationRecipeManager(); + private List integrationRecipes = new LinkedList(); + + @Override + public void addRecipe(IIntegrationRecipe recipe) { + integrationRecipes.add(recipe); + } + + @Override + public List getRecipes() { + return integrationRecipes; + } +} diff --git a/common/buildcraft/silicon/TileIntegrationTable.java b/common/buildcraft/silicon/TileIntegrationTable.java new file mode 100644 index 0000000000..7d88e3a0a5 --- /dev/null +++ b/common/buildcraft/silicon/TileIntegrationTable.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) SpaceToad, 2011-2012 + * 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.silicon; + +/** + * + * @author CovertJaguar + */ +public class TileIntegrationTable extends TileLaserTableBase { + + @Override + public double getRequiredEnergy() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean canCraft() { + throw new UnsupportedOperationException("Not supported yet."); + } +}