Website Recipe Exporter.
This commit is contained in:
@@ -9,8 +9,10 @@ import appeng.api.exceptions.RecipeError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.recipes.ICraftHandler;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
import appeng.recipes.RecipeHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class Grind implements ICraftHandler
|
||||
public class Grind implements ICraftHandler, IWebsiteSeralizer
|
||||
{
|
||||
|
||||
IIngredient pro_input;
|
||||
@@ -39,4 +41,16 @@ public class Grind implements ICraftHandler
|
||||
AEApi.instance().registries().grinder().addRecipe( is, pro_output[0].getItemStack(), 8 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError {
|
||||
return Platform.isSameItemPrecise( pro_output[0].getItemStack(),output );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern( RecipeHandler h ) {
|
||||
return "grind\n"+
|
||||
h.getName(pro_input)+"\n"+
|
||||
h.getName(pro_output[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package appeng.recipes.handlers;
|
||||
|
||||
import appeng.recipes.RecipeHandler;
|
||||
|
||||
public interface IWebsiteSeralizer {
|
||||
|
||||
String getPattern( RecipeHandler han );
|
||||
|
||||
}
|
||||
@@ -10,8 +10,10 @@ import appeng.api.recipes.ICraftHandler;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.integration.abstraction.IIC2;
|
||||
import appeng.recipes.RecipeHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class Macerator implements ICraftHandler
|
||||
public class Macerator implements ICraftHandler, IWebsiteSeralizer
|
||||
{
|
||||
|
||||
IIngredient pro_input;
|
||||
@@ -44,4 +46,16 @@ public class Macerator implements ICraftHandler
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError {
|
||||
return Platform.isSameItemPrecise( pro_output[0].getItemStack(),output );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern( RecipeHandler h ) {
|
||||
return "macerator\n"+
|
||||
h.getName(pro_input)+"\n"+
|
||||
h.getName(pro_output[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,4 +38,10 @@ public class OreRegistration implements ICraftHandler
|
||||
List<List<IIngredient>> output) throws RecipeError {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,9 +9,11 @@ import appeng.api.exceptions.RecipeError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.recipes.ICraftHandler;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
import appeng.recipes.RecipeHandler;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
|
||||
public class Pulverizer implements ICraftHandler
|
||||
public class Pulverizer implements ICraftHandler, IWebsiteSeralizer
|
||||
{
|
||||
|
||||
IIngredient pro_input;
|
||||
@@ -49,4 +51,17 @@ public class Pulverizer implements ICraftHandler
|
||||
FMLInterModComms.sendMessage( "ThermalExpansion", "PulverizerRecipe", toSend );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError {
|
||||
return Platform.isSameItemPrecise( pro_output[0].getItemStack(),output );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern( RecipeHandler h ) {
|
||||
return "pulverizer\n"+
|
||||
h.getName(pro_input)+"\n"+
|
||||
h.getName(pro_output[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,10 +10,12 @@ import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.recipes.ICraftHandler;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
import appeng.core.AELog;
|
||||
import appeng.recipes.Recipes.ShapedRecipe;
|
||||
import appeng.recipes.RecipeHandler;
|
||||
import appeng.recipes.game.ShapedRecipe;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class Shaped implements ICraftHandler
|
||||
public class Shaped implements ICraftHandler, IWebsiteSeralizer
|
||||
{
|
||||
|
||||
private int rows;
|
||||
@@ -87,4 +89,29 @@ public class Shaped implements ICraftHandler
|
||||
throw new RegistrationError( "Error while adding shaped recipe." );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(ItemStack reqOutput) throws RegistrationError, MissingIngredientError {
|
||||
return Platform.isSameItemPrecise( output.getItemStack(),reqOutput );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern( RecipeHandler h ) {
|
||||
String o = "shaped "+output.getQty()+"\n";
|
||||
|
||||
o += h.getName(output)+"\n";
|
||||
|
||||
for ( int y = 0; y < rows; y++ )
|
||||
for ( int x= 0; x< cols; x++ )
|
||||
{
|
||||
IIngredient i = inputs.get(y).get(x);
|
||||
if ( i.isAir() )
|
||||
o += "air"+( x +1 == cols ? "\n" : " " );
|
||||
else
|
||||
o += h.getName(i)+( x +1 == cols ? "\n" : " " );
|
||||
}
|
||||
|
||||
return o.trim();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,10 +10,12 @@ import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.recipes.ICraftHandler;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
import appeng.core.AELog;
|
||||
import appeng.recipes.Recipes.ShapelessRecipe;
|
||||
import appeng.recipes.RecipeHandler;
|
||||
import appeng.recipes.game.ShapelessRecipe;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class Shapeless implements ICraftHandler
|
||||
public class Shapeless implements ICraftHandler, IWebsiteSeralizer
|
||||
{
|
||||
|
||||
List<IIngredient> inputs;
|
||||
@@ -55,4 +57,28 @@ public class Shapeless implements ICraftHandler
|
||||
throw new RegistrationError( "Erro while adding shapeless recipe." );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(ItemStack reqOutput) throws RegistrationError, MissingIngredientError {
|
||||
return Platform.isSameItemPrecise( output.getItemStack(),reqOutput );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern( RecipeHandler h) {
|
||||
String o = "shapeless "+output.getQty()+"\n";
|
||||
|
||||
o += h.getName(output)+"\n";
|
||||
|
||||
for ( int y = 0; y < inputs.size(); y++ )
|
||||
{
|
||||
IIngredient i = inputs.get(y);
|
||||
if ( i.isAir() )
|
||||
o += "air"+( y +1 == inputs.size() ? "\n" : " " );
|
||||
else
|
||||
o += h.getName(i)+( y +1 == inputs.size() ? "\n" : " " );
|
||||
}
|
||||
|
||||
return o.trim();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,14 +2,18 @@ package appeng.recipes.handlers;
|
||||
|
||||
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.recipes.RecipeHandler;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class Smelt implements ICraftHandler
|
||||
public class Smelt implements ICraftHandler, IWebsiteSeralizer
|
||||
{
|
||||
|
||||
IIngredient in;
|
||||
@@ -44,4 +48,15 @@ public class Smelt implements ICraftHandler
|
||||
GameRegistry.addSmelting( in.getItemStack(), out.getItemStack(), 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(ItemStack reqOutput) throws RegistrationError, MissingIngredientError {
|
||||
return Platform.isSameItemPrecise( out.getItemStack(),reqOutput );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern( RecipeHandler h ) {
|
||||
return "smelt "+out.getQty()+"\n"+
|
||||
h.getName(in)+"\n"+
|
||||
h.getName(out);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user