Recipe API Update.
This commit is contained in:
+1
-8
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+21
-21
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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, "" );
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user