From bea8f2cc0732e508242fc5660f317bea67809c9a Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Wed, 19 Feb 2014 17:33:36 -0600 Subject: [PATCH] Recipe API Update. --- api | 2 +- core/Api.java | 9 +-- core/AppEng.java | 42 ++++++------- core/Registration.java | 13 ++++ .../registries/RecipeHandlerRegistry.java | 39 ++++++++++++ .../registries/RegistryContainer.java | 7 +++ integration/BaseModule.java | 8 ++- integration/abstraction/IUE.java | 6 -- integration/modules/BC.java | 4 +- integration/modules/Waila.java | 60 +++++++++++++++++++ integration/modules/dead/UE.java | 24 -------- recipes/Ingredient.java | 35 ++++++++++- recipes/MissingIngredientError.java | 11 ---- recipes/RecipeData.java | 4 +- recipes/RecipeError.java | 12 ---- recipes/RecipeHandler.java | 45 +++++++------- recipes/RegistrationError.java | 12 ---- recipes/handlers/CraftHandler.java | 21 ------- recipes/handlers/Grind.java | 23 ++++++- recipes/handlers/OreRegistration.java | 24 +++++--- recipes/handlers/Pureify.java | 23 +++---- recipes/handlers/Shaped.java | 23 +++---- recipes/handlers/Shapeless.java | 23 +++---- recipes/handlers/Smelt.java | 21 +++---- recipes/ores/OreDictionaryHandler.java | 2 +- tile/storage/TileChest.java | 2 - 26 files changed, 292 insertions(+), 203 deletions(-) create mode 100644 core/features/registries/RecipeHandlerRegistry.java delete mode 100644 integration/abstraction/IUE.java create mode 100644 integration/modules/Waila.java delete mode 100644 integration/modules/dead/UE.java delete mode 100644 recipes/MissingIngredientError.java delete mode 100644 recipes/RecipeError.java delete mode 100644 recipes/RegistrationError.java delete mode 100644 recipes/handlers/CraftHandler.java diff --git a/api b/api index 5eac4a9b..7834e09f 160000 --- a/api +++ b/api @@ -1 +1 @@ -Subproject commit 5eac4a9b50819f7f0dfa3a2393d359d94a9ddd8b +Subproject commit 7834e09f349699868a1074879a7a3902e3fd2bf4 diff --git a/core/Api.java b/core/Api.java index dc772348..dd910be2 100644 --- a/core/Api.java +++ b/core/Api.java @@ -12,14 +12,12 @@ import appeng.api.networking.IGridBlock; import appeng.api.networking.IGridConnection; import appeng.api.networking.IGridNode; import appeng.api.parts.IPartHelper; -import appeng.api.recipes.IRecipeHandler; import appeng.api.storage.IStorageHelper; import appeng.core.api.ApiPart; import appeng.core.api.ApiStorage; import appeng.core.features.registries.RegistryContainer; import appeng.me.GridConnection; import appeng.me.GridNode; -import appeng.recipes.RecipeHandler; import appeng.util.Platform; public class Api implements IAppEngApi @@ -34,6 +32,7 @@ public class Api implements IAppEngApi // private MovableTileRegistry MovableRegistry = new MovableTileRegistry(); private RegistryContainer rc = new RegistryContainer(); private ApiStorage storageHelper = new ApiStorage(); + public ApiPart partHelper = new ApiPart(); private Materials materials = new Materials(); @@ -97,10 +96,4 @@ public class Api implements IAppEngApi return new GridConnection( a, b, ForgeDirection.UNKNOWN ); } - @Override - public IRecipeHandler createNewRecipeHandler() - { - return new RecipeHandler(); - } - } diff --git a/core/AppEng.java b/core/AppEng.java index b066f5bf..7b0f4250 100644 --- a/core/AppEng.java +++ b/core/AppEng.java @@ -63,28 +63,28 @@ public class AppEng private IntegrationRegistry integrationModules = new IntegrationRegistry( new Object[] { /** - * Display Name, ModID ClassPostFix + * Side, Display Name, ModID ClassPostFix */ - IntegrationSide.BOTH, "Industrial Craft 2", "IC2", "IC2", // IC2 - IntegrationSide.BOTH, "Railcraft", "Railcraft", "RC", // RC - IntegrationSide.BOTH, "Thermal Expansion", "ThermalExpansion", "TE", // TE - IntegrationSide.BOTH, "Mystcraft", "Mystcraft", "Mystcraft", // MC - IntegrationSide.BOTH, "BuildCraft", "BuildCraft|Silicon", "BC", // BC - IntegrationSide.BOTH, "BuildCraft Power", null, "MJ", // BC - IntegrationSide.BOTH, "Greg Tech", "gregtech_addon", "GT", // GT - IntegrationSide.BOTH, "Universal Electricity", null, "UE", // UE - IntegrationSide.BOTH, "Logistics Pipes", "LogisticsPipes|Main", "LP", // LP - // IntegrationSide.CLIENT, "Inventory Tweaks", "", "InvTweaks", - // IntegrationSide.BOTH, "Mine Factory Reloaded", "MineFactoryReloaded", "MFR", // MFR - IntegrationSide.BOTH, "Deep Storage Unit", null, "DSU", // DSU - IntegrationSide.BOTH, "Better Storage", "betterstorage", "BS", // BS - IntegrationSide.BOTH, "Factorization", "factorization", "FZ", // FZ - IntegrationSide.BOTH, "Forestry", "Forestry", "Forestry", // Forestry - IntegrationSide.BOTH, "Mekanism", "Mekanism", "Mekanism", // MeK - IntegrationSide.CLIENT, "Not Enought Items", "NotEnoughItems", "NEI", // Not - // Eneough - // Items - IntegrationSide.BOTH, "Forge MultiPart", "McMultipart", "FMP" } ); + IntegrationSide.BOTH, "Industrial Craft 2", "IC2", "IC2", // IC2 + //IntegrationSide.BOTH, "Railcraft", "Railcraft", "RC", // RC + //IntegrationSide.BOTH, "Thermal Expansion", "ThermalExpansion", "TE", // TE + //IntegrationSide.BOTH, "Mystcraft", "Mystcraft", "Mystcraft", // MC + IntegrationSide.BOTH, "BuildCraft", "BuildCraft|Silicon", "BC", // BC + IntegrationSide.BOTH, "BuildCraft Power", null, "MJ", // BC + //IntegrationSide.BOTH, "Greg Tech", "gregtech_addon", "GT", // GT + //IntegrationSide.BOTH, "Universal Electricity", null, "UE", // UE + //IntegrationSide.BOTH, "Logistics Pipes", "LogisticsPipes|Main", "LP", // LP + // IntegrationSide.CLIENT, "Inventory Tweaks", "", "InvTweaks", // InvTweaks + // IntegrationSide.BOTH, "Mine Factory Reloaded", "MineFactoryReloaded", "MFR", // MFR + IntegrationSide.BOTH, "Deep Storage Unit", null, "DSU", // DSU + //IntegrationSide.BOTH, "Better Storage", "betterstorage", "BS", // BS + //IntegrationSide.BOTH, "Factorization", "factorization", "FZ", // FZ + //IntegrationSide.BOTH, "Forestry", "Forestry", "Forestry", // Forestry + //IntegrationSide.BOTH, "Mekanism", "Mekanism", "Mekanism", // MeK + //IntegrationSide.CLIENT, "Waila", "Waila", "Waila", // Waila + //IntegrationSide.CLIENT, "Not Enough Items", "NotEnoughItems", "NEI", // NEI + //IntegrationSide.BOTH, "Forge MultiPart", "McMultipart", "FMP" // FMP + }); public boolean isIntegrationEnabled(String Name) { diff --git a/core/Registration.java b/core/Registration.java index 0a769ffa..1de2c31f 100644 --- a/core/Registration.java +++ b/core/Registration.java @@ -15,6 +15,7 @@ import appeng.api.definitions.Blocks; import appeng.api.definitions.Items; import appeng.api.definitions.Materials; import appeng.api.definitions.Parts; +import appeng.api.features.IRecipeHandlerRegistry; import appeng.api.features.IWirelessTermHandler; import appeng.api.networking.IGridCacheRegistry; import appeng.api.networking.energy.IEnergyGrid; @@ -113,6 +114,11 @@ import appeng.me.storage.AEExternalHandler; import appeng.recipes.RecipeHandler; import appeng.recipes.Recipes.ShapedRecipe; import appeng.recipes.Recipes.ShapelessRecipe; +import appeng.recipes.handlers.Grind; +import appeng.recipes.handlers.Pureify; +import appeng.recipes.handlers.Shaped; +import appeng.recipes.handlers.Shapeless; +import appeng.recipes.handlers.Smelt; import appeng.recipes.loader.ConfigLoader; import appeng.recipes.loader.JarLoader; import appeng.recipes.ores.OreDictionaryHandler; @@ -143,6 +149,13 @@ public class Registration public void PreInit(FMLPreInitializationEvent event) { + IRecipeHandlerRegistry recipeRegistery = AEApi.instance().registries().recipes(); + recipeRegistery.addNewCraftHandler("grind", Grind.class); + recipeRegistery.addNewCraftHandler("shaped", Shaped.class); + recipeRegistery.addNewCraftHandler("shapeless", Shapeless.class); + recipeRegistery.addNewCraftHandler("smelt", Smelt.class); + recipeRegistery.addNewCraftHandler("pureify", Pureify.class); + RecipeSorter.register( "AE2-Shaped", ShapedRecipe.class, Category.SHAPED, "" ); RecipeSorter.register( "AE2-Shapeless", ShapelessRecipe.class, Category.SHAPELESS, "" ); diff --git a/core/features/registries/RecipeHandlerRegistry.java b/core/features/registries/RecipeHandlerRegistry.java new file mode 100644 index 00000000..c325e498 --- /dev/null +++ b/core/features/registries/RecipeHandlerRegistry.java @@ -0,0 +1,39 @@ +package appeng.core.features.registries; + +import java.util.HashMap; + +import appeng.api.features.IRecipeHandlerRegistry; +import appeng.api.recipes.ICraftHandler; +import appeng.api.recipes.IRecipeHandler; +import appeng.core.AELog; +import appeng.recipes.RecipeHandler; + +public class RecipeHandlerRegistry implements IRecipeHandlerRegistry{ + + HashMap> handlers = new HashMap>(); + + @Override + public void addNewCraftHandler(String name, Class handler) { + handlers.put(name.toLowerCase(), handler); + } + + @Override + public ICraftHandler getCraftHandlerFor(String name) { + Class clz= handlers.get(name); + if ( clz == null ) return null; + try { + return clz.newInstance(); + } catch (Throwable e) { + AELog.severe("Error Caused when trying to construct "+clz.getName()); + AELog.error(e); + handlers.put(name, null); // clear it.. + return null; + } + } + + @Override + public IRecipeHandler createNewRecipehandler() { + return new RecipeHandler(); + } + +} diff --git a/core/features/registries/RegistryContainer.java b/core/features/registries/RegistryContainer.java index 7d171981..8d42f9d4 100644 --- a/core/features/registries/RegistryContainer.java +++ b/core/features/registries/RegistryContainer.java @@ -5,6 +5,7 @@ import appeng.api.features.ILocateableRegistry; import appeng.api.features.IMatterCannonAmmoRegistry; import appeng.api.features.IP2PTunnelRegistry; import appeng.api.features.IPlayerRegistry; +import appeng.api.features.IRecipeHandlerRegistry; import appeng.api.features.IRegistryContainer; import appeng.api.features.ISpecialComparisonRegistry; import appeng.api.features.IWirelessTermRegistery; @@ -27,6 +28,7 @@ public class RegistryContainer implements IRegistryContainer private MovableTileRegistry MoveableReg = new MovableTileRegistry(); private MatterCannonAmmoRegistry matterCannonReg = new MatterCannonAmmoRegistry(); private PlayerRegistry playerreg = new PlayerRegistry(); +private IRecipeHandlerRegistry recipeReg = new RecipeHandlerRegistry(); @Override public IWirelessTermRegistery wireless() @@ -94,4 +96,9 @@ public class RegistryContainer implements IRegistryContainer return playerreg; } + @Override + public IRecipeHandlerRegistry recipes() { + return recipeReg; + } + } diff --git a/integration/BaseModule.java b/integration/BaseModule.java index 6af43231..58cd250c 100644 --- a/integration/BaseModule.java +++ b/integration/BaseModule.java @@ -1,10 +1,16 @@ package appeng.integration; -public class BaseModule { +public abstract class BaseModule implements IIntegrationModule { protected void TestClass( Class clz ) { clz.isInstance(this); } + + @Override + public abstract void Init() throws Throwable; + + @Override + public abstract void PostInit() throws Throwable; } diff --git a/integration/abstraction/IUE.java b/integration/abstraction/IUE.java deleted file mode 100644 index 354f74b6..00000000 --- a/integration/abstraction/IUE.java +++ /dev/null @@ -1,6 +0,0 @@ -package appeng.integration.abstraction; - -public interface IUE -{ - -} \ No newline at end of file diff --git a/integration/modules/BC.java b/integration/modules/BC.java index 4bfb4825..db0788c4 100644 --- a/integration/modules/BC.java +++ b/integration/modules/BC.java @@ -13,10 +13,8 @@ import appeng.api.features.IP2PTunnelRegistry; import appeng.api.parts.IFacadePart; import appeng.facade.FacadePart; import appeng.integration.BaseModule; -import appeng.integration.IIntegrationModule; import appeng.integration.abstraction.IBC; import appeng.integration.modules.helpers.BCPipeHandler; -import appeng.integration.modules.helpers.MJPerdition; import buildcraft.BuildCraftEnergy; import buildcraft.BuildCraftTransport; import buildcraft.api.tools.IToolWrench; @@ -28,7 +26,7 @@ import buildcraft.transport.PipeIconProvider; import buildcraft.transport.TileGenericPipe; import cpw.mods.fml.common.event.FMLInterModComms; -public class BC extends BaseModule implements IIntegrationModule, IBC +public class BC extends BaseModule implements IBC { public static BC instance; diff --git a/integration/modules/Waila.java b/integration/modules/Waila.java new file mode 100644 index 00000000..64a01620 --- /dev/null +++ b/integration/modules/Waila.java @@ -0,0 +1,60 @@ +package appeng.integration.modules; + +import java.util.List; + +import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.event.FMLInterModComms; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaDataProvider; +import mcp.mobius.waila.api.IWailaRegistrar; +import appeng.block.AEBaseBlock; +import appeng.core.AppEng; +import appeng.integration.BaseModule; + +public class Waila extends BaseModule implements IWailaDataProvider { + + public static void yourRegistrationMethod(IWailaRegistrar registrar) + { + registrar.registerHeadProvider( (Waila)AppEng.instance.getIntegration("Waila"), AEBaseBlock.class); + registrar.registerBodyProvider( (Waila)AppEng.instance.getIntegration("Waila"), AEBaseBlock.class); + registrar.registerTailProvider( (Waila)AppEng.instance.getIntegration("Waila"), AEBaseBlock.class); + } + + @Override + public void Init() throws Throwable { + TestClass( IWailaDataProvider.class ); + TestClass( IWailaRegistrar.class ); + FMLInterModComms.sendMessage("Waila", "register", "mcp.mobius.waila_demo.ProviderDemo.callbackRegister"); + } + + @Override + public void PostInit() throws Throwable { + // :P + } + + @Override + public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) { + + return null; + } + + @Override + public List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + + return currenttip; + } + + @Override + public List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + currenttip.add("AE2 Says Hi"); + return currenttip; + } + + @Override + public List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + + return currenttip; + } + +} diff --git a/integration/modules/dead/UE.java b/integration/modules/dead/UE.java deleted file mode 100644 index e656ce17..00000000 --- a/integration/modules/dead/UE.java +++ /dev/null @@ -1,24 +0,0 @@ -package appeng.integration.modules.dead; - -import appeng.integration.IIntegrationModule; - -public class UE implements IIntegrationModule -{ - - public static UE instance; - - @Override - public void Init() - { - // TODO Auto-generated method stub - - } - - @Override - public void PostInit() - { - // TODO Auto-generated method stub - - } - -} diff --git a/recipes/Ingredient.java b/recipes/Ingredient.java index cd929b3d..9969b363 100644 --- a/recipes/Ingredient.java +++ b/recipes/Ingredient.java @@ -6,13 +6,17 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; +import appeng.api.exceptions.MissingIngredientError; +import appeng.api.exceptions.RecipeError; +import appeng.api.exceptions.RegistrationError; +import appeng.api.recipes.IIngredient; import appeng.core.AppEng; import appeng.items.materials.MaterialType; import appeng.items.parts.ItemPart; import appeng.items.parts.PartType; import cpw.mods.fml.common.registry.GameRegistry; -public class Ingredient +public class Ingredient implements IIngredient { final public boolean isAir; @@ -106,6 +110,7 @@ public class Ingredient throw new RecipeError( input + " : Needs at least Namespace and Name." ); } + @Override public ItemStack getItemStack() throws RegistrationError, MissingIngredientError { if ( isAir ) @@ -150,7 +155,8 @@ public class Ingredient return nameSpace + ":" + itemName + ":" + meta; } - public ItemStack[] getSet() throws RegistrationError, MissingIngredientError + @Override + public ItemStack[] getItemStackSet() throws RegistrationError, MissingIngredientError { if ( nameSpace.equalsIgnoreCase( "oreDictionary" ) ) { @@ -171,4 +177,29 @@ public class Ingredient return new ItemStack[] { getItemStack() }; } + @Override + public String getNameSpace() { + return nameSpace; + } + + @Override + public String getItemName() { + return itemName; + } + + @Override + public int getDamageValue() { + return meta; + } + + @Override + public int getQty() { + return qty; + } + + @Override + public boolean isAir() { + return isAir; + } + } diff --git a/recipes/MissingIngredientError.java b/recipes/MissingIngredientError.java deleted file mode 100644 index 868eb72b..00000000 --- a/recipes/MissingIngredientError.java +++ /dev/null @@ -1,11 +0,0 @@ -package appeng.recipes; - -public class MissingIngredientError extends Exception { - - private static final long serialVersionUID = -998858343831371697L; - - public MissingIngredientError(String n) { - super( n ); - } - -} diff --git a/recipes/RecipeData.java b/recipes/RecipeData.java index 16a89fe0..29dbf934 100644 --- a/recipes/RecipeData.java +++ b/recipes/RecipeData.java @@ -4,13 +4,13 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; -import appeng.recipes.handlers.CraftHandler; +import appeng.api.recipes.ICraftHandler; public class RecipeData { final public HashMap aliases = new HashMap(); - final public List Handlers = new LinkedList(); + final public List Handlers = new LinkedList(); public boolean crash = true; public boolean erroronmissing = true; diff --git a/recipes/RecipeError.java b/recipes/RecipeError.java deleted file mode 100644 index 74fbe067..00000000 --- a/recipes/RecipeError.java +++ /dev/null @@ -1,12 +0,0 @@ -package appeng.recipes; - -public class RecipeError extends Exception -{ - - private static final long serialVersionUID = -6602870588617670262L; - - public RecipeError(String n) { - super( n ); - } - -} diff --git a/recipes/RecipeHandler.java b/recipes/RecipeHandler.java index 4f53ed1c..1d55ab52 100644 --- a/recipes/RecipeHandler.java +++ b/recipes/RecipeHandler.java @@ -6,10 +6,16 @@ import java.util.LinkedList; import java.util.List; import java.util.Map.Entry; +import appeng.api.AEApi; +import appeng.api.exceptions.MissingIngredientError; +import appeng.api.exceptions.RecipeError; +import appeng.api.exceptions.RegistrationError; +import appeng.api.features.IRecipeHandlerRegistry; +import appeng.api.recipes.ICraftHandler; +import appeng.api.recipes.IIngredient; import appeng.api.recipes.IRecipeHandler; import appeng.api.recipes.IRecipeLoader; import appeng.core.AELog; -import appeng.recipes.handlers.CraftHandler; import appeng.recipes.handlers.Grind; import appeng.recipes.handlers.OreRegistration; import appeng.recipes.handlers.Pureify; @@ -31,7 +37,7 @@ public class RecipeHandler implements IRecipeHandler data = parent.data; } - private void addCrafting(CraftHandler ch) + private void addCrafting(ICraftHandler ch) { data.Handlers.add( ch ); } @@ -42,7 +48,7 @@ public class RecipeHandler implements IRecipeHandler HashMap processed = new HashMap(); try { - for (CraftHandler ch : data.Handlers) + for (ICraftHandler ch : data.Handlers) { try { @@ -206,6 +212,8 @@ public class RecipeHandler implements IRecipeHandler { try { + IRecipeHandlerRegistry cr = AEApi.instance().registries().recipes(); + if ( tokens.isEmpty() ) return; @@ -226,7 +234,7 @@ public class RecipeHandler implements IRecipeHandler List pre = tokens.subList( 0, split - 1 ); List post = tokens.subList( split, tokens.size() ); - List> inputs = parseLines( pre ); + List> inputs = parseLines( pre ); if ( inputs.size() >= 1 && post.size() == 1 ) { @@ -240,11 +248,11 @@ public class RecipeHandler implements IRecipeHandler List pre = tokens.subList( 0, split - 1 ); List post = tokens.subList( split, tokens.size() ); - List> inputs = parseLines( pre ); + List> inputs = parseLines( pre ); if ( inputs.size() == 1 && inputs.get( 0 ).size() > 0 && post.size() == 1 ) { - CraftHandler ch = new OreRegistration( inputs.get( 0 ), post.get( 0 ) ); + ICraftHandler ch = new OreRegistration( inputs.get( 0 ), post.get( 0 ) ); addCrafting( ch ); } else @@ -255,21 +263,10 @@ public class RecipeHandler implements IRecipeHandler List pre = tokens.subList( 0, split - 1 ); List post = tokens.subList( split, tokens.size() ); - List> inputs = parseLines( pre ); - List> outputs = parseLines( post ); + List> inputs = parseLines( pre ); + List> outputs = parseLines( post ); - CraftHandler ch = null; - - if ( operation.equals( "shaped" ) ) - ch = new Shaped(); - else if ( operation.equals( "shapeless" ) ) - ch = new Shapeless(); - else if ( operation.equals( "smelt" ) ) - ch = new Smelt(); - else if ( operation.equals( "pureify" ) ) - ch = new Pureify(); - else if ( operation.equals( "grind" ) ) - ch = new Grind(); + ICraftHandler ch = cr.getCraftHandlerFor(operation); if ( ch != null ) { @@ -325,10 +322,10 @@ public class RecipeHandler implements IRecipeHandler tokens.clear(); } - private List> parseLines(List subList) throws RecipeError + private List> parseLines(List subList) throws RecipeError { - List> out = new LinkedList>(); - List cList = new LinkedList(); + List> out = new LinkedList>(); + List cList = new LinkedList(); boolean hasQty = false; int qty = 1; @@ -341,7 +338,7 @@ public class RecipeHandler implements IRecipeHandler throw new RecipeError( "Qty found with no item." ); if ( !cList.isEmpty() ) out.add( cList ); - cList = new LinkedList(); + cList = new LinkedList(); } else { diff --git a/recipes/RegistrationError.java b/recipes/RegistrationError.java deleted file mode 100644 index 5cfccc8d..00000000 --- a/recipes/RegistrationError.java +++ /dev/null @@ -1,12 +0,0 @@ -package appeng.recipes; - -public class RegistrationError extends Exception -{ - - private static final long serialVersionUID = -6602870588617670263L; - - public RegistrationError(String n) { - super( n ); - } - -} diff --git a/recipes/handlers/CraftHandler.java b/recipes/handlers/CraftHandler.java deleted file mode 100644 index e9169d37..00000000 --- a/recipes/handlers/CraftHandler.java +++ /dev/null @@ -1,21 +0,0 @@ -package appeng.recipes.handlers; - -import java.util.List; - -import appeng.recipes.Ingredient; -import appeng.recipes.MissingIngredientError; -import appeng.recipes.RecipeError; -import appeng.recipes.RegistrationError; - -public class CraftHandler -{ - - public void setup(List> input, List> output) throws RecipeError - { - } - - public void register() throws RegistrationError, MissingIngredientError - { - } - -} diff --git a/recipes/handlers/Grind.java b/recipes/handlers/Grind.java index 58ea29cc..9df34da8 100644 --- a/recipes/handlers/Grind.java +++ b/recipes/handlers/Grind.java @@ -1,6 +1,27 @@ package appeng.recipes.handlers; -public class Grind extends CraftHandler +import java.util.List; + +import appeng.api.exceptions.MissingIngredientError; +import appeng.api.exceptions.RecipeError; +import appeng.api.exceptions.RegistrationError; +import appeng.api.recipes.ICraftHandler; +import appeng.api.recipes.IIngredient; + +public class Grind implements ICraftHandler { + @Override + public void setup(List> input, + List> output) throws RecipeError { + // TODO Auto-generated method stub + + } + + @Override + public void register() throws RegistrationError, MissingIngredientError { + // TODO Auto-generated method stub + + } + } diff --git a/recipes/handlers/OreRegistration.java b/recipes/handlers/OreRegistration.java index 6f16a25c..4f4afbcd 100644 --- a/recipes/handlers/OreRegistration.java +++ b/recipes/handlers/OreRegistration.java @@ -4,17 +4,19 @@ import java.util.List; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -import appeng.recipes.Ingredient; -import appeng.recipes.MissingIngredientError; -import appeng.recipes.RegistrationError; +import appeng.api.exceptions.MissingIngredientError; +import appeng.api.exceptions.RecipeError; +import appeng.api.exceptions.RegistrationError; +import appeng.api.recipes.ICraftHandler; +import appeng.api.recipes.IIngredient; -public class OreRegistration extends CraftHandler +public class OreRegistration implements ICraftHandler { - List inputs; + List inputs; String name; - public OreRegistration(List in, String out) { + public OreRegistration(List in, String out) { inputs = in; name = out; } @@ -22,12 +24,18 @@ public class OreRegistration extends CraftHandler @Override public void register() throws RegistrationError, MissingIngredientError { - for (Ingredient i : inputs) + for (IIngredient i : inputs) { - for (ItemStack is : i.getSet()) + for (ItemStack is : i.getItemStackSet()) { OreDictionary.registerOre( name, is ); } } } + + @Override + public void setup(List> input, + List> output) throws RecipeError { + + } } diff --git a/recipes/handlers/Pureify.java b/recipes/handlers/Pureify.java index c5ca8d37..cb87ab37 100644 --- a/recipes/handlers/Pureify.java +++ b/recipes/handlers/Pureify.java @@ -2,24 +2,25 @@ package appeng.recipes.handlers; import java.util.List; -import appeng.recipes.Ingredient; -import appeng.recipes.MissingIngredientError; -import appeng.recipes.RecipeError; -import appeng.recipes.RegistrationError; +import appeng.api.exceptions.MissingIngredientError; +import appeng.api.exceptions.RecipeError; +import appeng.api.exceptions.RegistrationError; +import appeng.api.recipes.ICraftHandler; +import appeng.api.recipes.IIngredient; -public class Pureify extends CraftHandler +public class Pureify implements ICraftHandler { - Ingredient in; - Ingredient out; + IIngredient in; + IIngredient out; @Override - public void setup(List> input, List> output) throws RecipeError + public void setup(List> input, List> output) throws RecipeError { if ( input.size() == 1 && output.size() == 1 ) { - List inputList = input.get( 0 ); - List outputList = output.get( 0 ); + List inputList = input.get( 0 ); + List outputList = output.get( 0 ); if ( inputList.size() == 1 && outputList.size() == 1 ) { in = inputList.get( 0 ); @@ -33,7 +34,7 @@ public class Pureify extends CraftHandler @Override public void register() throws RegistrationError, MissingIngredientError { - if ( in.getSet() == null ) + if ( in.getItemStackSet() == null ) throw new RegistrationError( in.toString() + ": Pureify Input is not a valid item." ); if ( out.getItemStack().getItem() == null ) diff --git a/recipes/handlers/Shaped.java b/recipes/handlers/Shaped.java index bd0576db..69242d94 100644 --- a/recipes/handlers/Shaped.java +++ b/recipes/handlers/Shaped.java @@ -4,25 +4,26 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.item.ItemStack; +import appeng.api.exceptions.MissingIngredientError; +import appeng.api.exceptions.RecipeError; +import appeng.api.exceptions.RegistrationError; +import appeng.api.recipes.ICraftHandler; +import appeng.api.recipes.IIngredient; import appeng.core.AELog; -import appeng.recipes.Ingredient; -import appeng.recipes.MissingIngredientError; -import appeng.recipes.RecipeError; -import appeng.recipes.RegistrationError; import appeng.recipes.Recipes.ShapedRecipe; import cpw.mods.fml.common.registry.GameRegistry; -public class Shaped extends CraftHandler +public class Shaped implements ICraftHandler { private int rows; private int cols; - List> inputs; - Ingredient output; + List> inputs; + IIngredient output; @Override - public void setup(List> input, List> output) throws RecipeError + public void setup(List> input, List> output) throws RecipeError { if ( output.size() == 1 && output.get( 0 ).size() == 1 ) { @@ -48,20 +49,20 @@ public class Shaped extends CraftHandler public void register() throws RegistrationError, MissingIngredientError { char first = 'A'; - List args = new ArrayList(); + List args = new ArrayList(); for (int y = 0; y < rows; y++) { String row = ""; for (int x = 0; x < cols; x++) { - if ( inputs.get( y ).get( x ).isAir ) + if ( inputs.get( y ).get( x ).isAir() ) row = row + " "; else { row = row + first; args.add( first ); - args.add( inputs.get( y ).get( x ).getSet() ); + args.add( inputs.get( y ).get( x ).getItemStackSet() ); first++; } diff --git a/recipes/handlers/Shapeless.java b/recipes/handlers/Shapeless.java index 497bde0b..3ec629a3 100644 --- a/recipes/handlers/Shapeless.java +++ b/recipes/handlers/Shapeless.java @@ -4,22 +4,23 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.item.ItemStack; +import appeng.api.exceptions.MissingIngredientError; +import appeng.api.exceptions.RecipeError; +import appeng.api.exceptions.RegistrationError; +import appeng.api.recipes.ICraftHandler; +import appeng.api.recipes.IIngredient; import appeng.core.AELog; -import appeng.recipes.Ingredient; -import appeng.recipes.MissingIngredientError; -import appeng.recipes.RecipeError; -import appeng.recipes.RegistrationError; import appeng.recipes.Recipes.ShapelessRecipe; import cpw.mods.fml.common.registry.GameRegistry; -public class Shapeless extends CraftHandler +public class Shapeless implements ICraftHandler { - List inputs; - Ingredient output; + List inputs; + IIngredient output; @Override - public void setup(List> input, List> output) throws RecipeError + public void setup(List> input, List> output) throws RecipeError { if ( output.size() == 1 && output.get( 0 ).size() == 1 ) { @@ -38,9 +39,9 @@ public class Shapeless extends CraftHandler @Override public void register() throws RegistrationError, MissingIngredientError { - List args = new ArrayList(); - for (Ingredient i : inputs) - args.add( i.getSet() ); + List args = new ArrayList(); + for (IIngredient i : inputs) + args.add( i.getItemStackSet() ); ItemStack outIS = output.getItemStack(); diff --git a/recipes/handlers/Smelt.java b/recipes/handlers/Smelt.java index d62e1c72..35d77752 100644 --- a/recipes/handlers/Smelt.java +++ b/recipes/handlers/Smelt.java @@ -2,25 +2,26 @@ package appeng.recipes.handlers; import java.util.List; -import appeng.recipes.Ingredient; -import appeng.recipes.MissingIngredientError; -import appeng.recipes.RecipeError; -import appeng.recipes.RegistrationError; +import appeng.api.exceptions.MissingIngredientError; +import appeng.api.exceptions.RecipeError; +import appeng.api.exceptions.RegistrationError; +import appeng.api.recipes.ICraftHandler; +import appeng.api.recipes.IIngredient; import cpw.mods.fml.common.registry.GameRegistry; -public class Smelt extends CraftHandler +public class Smelt implements ICraftHandler { - Ingredient in; - Ingredient out; + IIngredient in; + IIngredient out; @Override - public void setup(List> input, List> output) throws RecipeError + public void setup(List> input, List> output) throws RecipeError { if ( input.size() == 1 && output.size() == 1 ) { - List inputList = input.get( 0 ); - List outputList = output.get( 0 ); + List inputList = input.get( 0 ); + List outputList = output.get( 0 ); if ( inputList.size() == 1 && outputList.size() == 1 ) { in = inputList.get( 0 ); diff --git a/recipes/ores/OreDictionaryHandler.java b/recipes/ores/OreDictionaryHandler.java index 3c2c82a1..394212eb 100644 --- a/recipes/ores/OreDictionaryHandler.java +++ b/recipes/ores/OreDictionaryHandler.java @@ -12,7 +12,7 @@ public class OreDictionaryHandler public static final OreDictionaryHandler instance = new OreDictionaryHandler(); - private List ol = new ArrayList(); + private List ol = new ArrayList(); /** * Just limit what items are sent to the final listeners, I got sick of strange items showing up... diff --git a/tile/storage/TileChest.java b/tile/storage/TileChest.java index abe1034e..fcfa1e00 100644 --- a/tile/storage/TileChest.java +++ b/tile/storage/TileChest.java @@ -7,8 +7,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import scala.collection.ViewMkString; - import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack;