Recipe API Update.

This commit is contained in:
AlgorithmX2 2014-02-19 17:33:36 -06:00
parent 85b053f6b5
commit bea8f2cc07
26 changed files with 292 additions and 203 deletions

2
api

@ -1 +1 @@
Subproject commit 5eac4a9b50819f7f0dfa3a2393d359d94a9ddd8b
Subproject commit 7834e09f349699868a1074879a7a3902e3fd2bf4

View file

@ -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();
}
}

View file

@ -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, "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, "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, "Not Enought Items", "NotEnoughItems", "NEI", // Not
// Eneough
// Items
IntegrationSide.BOTH, "Forge MultiPart", "McMultipart", "FMP" } );
//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)
{

View file

@ -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, "" );

View file

@ -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<String,Class<? extends ICraftHandler>> handlers = new HashMap<String, Class<? extends ICraftHandler >>();
@Override
public void addNewCraftHandler(String name, Class<? extends ICraftHandler> handler) {
handlers.put(name.toLowerCase(), handler);
}
@Override
public ICraftHandler getCraftHandlerFor(String name) {
Class<? extends ICraftHandler> 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();
}
}

View file

@ -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;
}
}

View file

@ -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;
}

View file

@ -1,6 +0,0 @@
package appeng.integration.abstraction;
public interface IUE
{
}

View file

@ -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;

View file

@ -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<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
currenttip.add("AE2 Says Hi");
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}

View file

@ -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
}
}

View file

@ -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;
}
}

View file

@ -1,11 +0,0 @@
package appeng.recipes;
public class MissingIngredientError extends Exception {
private static final long serialVersionUID = -998858343831371697L;
public MissingIngredientError(String n) {
super( n );
}
}

View file

@ -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<String, String> aliases = new HashMap<String, String>();
final public List<CraftHandler> Handlers = new LinkedList<CraftHandler>();
final public List<ICraftHandler> Handlers = new LinkedList<ICraftHandler>();
public boolean crash = true;
public boolean erroronmissing = true;

View file

@ -1,12 +0,0 @@
package appeng.recipes;
public class RecipeError extends Exception
{
private static final long serialVersionUID = -6602870588617670262L;
public RecipeError(String n) {
super( n );
}
}

View file

@ -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<Class, Integer> processed = new HashMap<Class, Integer>();
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<String> pre = tokens.subList( 0, split - 1 );
List<String> post = tokens.subList( split, tokens.size() );
List<List<Ingredient>> inputs = parseLines( pre );
List<List<IIngredient>> inputs = parseLines( pre );
if ( inputs.size() >= 1 && post.size() == 1 )
{
@ -240,11 +248,11 @@ public class RecipeHandler implements IRecipeHandler
List<String> pre = tokens.subList( 0, split - 1 );
List<String> post = tokens.subList( split, tokens.size() );
List<List<Ingredient>> inputs = parseLines( pre );
List<List<IIngredient>> 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<String> pre = tokens.subList( 0, split - 1 );
List<String> post = tokens.subList( split, tokens.size() );
List<List<Ingredient>> inputs = parseLines( pre );
List<List<Ingredient>> outputs = parseLines( post );
List<List<IIngredient>> inputs = parseLines( pre );
List<List<IIngredient>> 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<List<Ingredient>> parseLines(List<String> subList) throws RecipeError
private List<List<IIngredient>> parseLines(List<String> subList) throws RecipeError
{
List<List<Ingredient>> out = new LinkedList<List<Ingredient>>();
List<Ingredient> cList = new LinkedList<Ingredient>();
List<List<IIngredient>> out = new LinkedList<List<IIngredient>>();
List<IIngredient> cList = new LinkedList<IIngredient>();
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<Ingredient>();
cList = new LinkedList<IIngredient>();
}
else
{

View file

@ -1,12 +0,0 @@
package appeng.recipes;
public class RegistrationError extends Exception
{
private static final long serialVersionUID = -6602870588617670263L;
public RegistrationError(String n) {
super( n );
}
}

View file

@ -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<List<Ingredient>> input, List<List<Ingredient>> output) throws RecipeError
{
}
public void register() throws RegistrationError, MissingIngredientError
{
}
}

View file

@ -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<List<IIngredient>> input,
List<List<IIngredient>> output) throws RecipeError {
// TODO Auto-generated method stub
}
@Override
public void register() throws RegistrationError, MissingIngredientError {
// TODO Auto-generated method stub
}
}

View file

@ -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<Ingredient> inputs;
List<IIngredient> inputs;
String name;
public OreRegistration(List<Ingredient> in, String out) {
public OreRegistration(List<IIngredient> 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<List<IIngredient>> input,
List<List<IIngredient>> output) throws RecipeError {
}
}

View file

@ -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<List<Ingredient>> input, List<List<Ingredient>> output) throws RecipeError
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
{
if ( input.size() == 1 && output.size() == 1 )
{
List<Ingredient> inputList = input.get( 0 );
List<Ingredient> outputList = output.get( 0 );
List<IIngredient> inputList = input.get( 0 );
List<IIngredient> 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 )

View file

@ -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<List<Ingredient>> inputs;
Ingredient output;
List<List<IIngredient>> inputs;
IIngredient output;
@Override
public void setup(List<List<Ingredient>> input, List<List<Ingredient>> output) throws RecipeError
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> 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<Object> args = new ArrayList();
List<Object> args = new ArrayList<Object>();
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++;
}

View file

@ -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<Ingredient> inputs;
Ingredient output;
List<IIngredient> inputs;
IIngredient output;
@Override
public void setup(List<List<Ingredient>> input, List<List<Ingredient>> output) throws RecipeError
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> 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<Object> args = new ArrayList();
for (Ingredient i : inputs)
args.add( i.getSet() );
List<Object> args = new ArrayList<Object>();
for (IIngredient i : inputs)
args.add( i.getItemStackSet() );
ItemStack outIS = output.getItemStack();

View file

@ -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<List<Ingredient>> input, List<List<Ingredient>> output) throws RecipeError
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
{
if ( input.size() == 1 && output.size() == 1 )
{
List<Ingredient> inputList = input.get( 0 );
List<Ingredient> outputList = output.get( 0 );
List<IIngredient> inputList = input.get( 0 );
List<IIngredient> outputList = output.get( 0 );
if ( inputList.size() == 1 && outputList.size() == 1 )
{
in = inputList.get( 0 );

View file

@ -12,7 +12,7 @@ public class OreDictionaryHandler
public static final OreDictionaryHandler instance = new OreDictionaryHandler();
private List<IOreListener> ol = new ArrayList();
private List<IOreListener> ol = new ArrayList<IOreListener>();
/**
* Just limit what items are sent to the final listeners, I got sick of strange items showing up...

View file

@ -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;