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
-21
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
{
}
}
+22 -1
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
}
}
+16 -8
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 {
}
}
+12 -11
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 )
+12 -11
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++;
}
+12 -11
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();
+11 -10
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 );