attempted to fix a load error

This commit is contained in:
DarkGuardsman 2013-07-23 23:50:07 -04:00
parent 533fef288e
commit 81c1d78ac1
3 changed files with 58 additions and 35 deletions

View file

@ -7,7 +7,7 @@ import net.minecraft.item.crafting.FurnaceRecipes;
import dark.core.items.EnumMeterials;
import dark.core.items.EnumOreParts;
public class CoreRecipeLoader
public class CoreRecipeLoader extends RecipeLoader
{
/* BLOCKS */
@ -16,12 +16,14 @@ public class CoreRecipeLoader
/* ITEMS */
public static Item itemMetals;
public static void loadRecipes()
@Override
public void loadRecipes()
{
super.loadRecipes();
loadSmeltingRecipes();
}
public static void loadSmeltingRecipes()
public void loadSmeltingRecipes()
{
if (blockOre != null && itemMetals != null)
{

View file

@ -15,6 +15,7 @@ import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.Metadata;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.SidedProxy;
@ -64,17 +65,20 @@ public class DarkMain extends ModPrefab
public static BlockMulti blockMulti;
@Instance(MOD_ID)
private static DarkMain instance;
public static CoreRecipeLoader recipeLoader;
public static DarkMain getInstance()
{
if(instance == null)
if (instance == null)
{
instance = new DarkMain();
}
return instance;
}
@EventHandler
@Override
public void preInit(FMLPreInitializationEvent event)
@ -94,7 +98,7 @@ public class DarkMain extends ModPrefab
{
super.init(event);
GameRegistry.registerBlock(recipeLoader.blockOre, ItemOre.class, "DMOre");
GameRegistry.registerBlock(CoreRecipeLoader.blockOre, ItemOre.class, "DMOre");
GameRegistry.registerBlock(blockMulti, "multiBlock");
GameRegistry.registerTileEntity(TileEntityMulti.class, "ALMulti");
@ -120,7 +124,7 @@ public class DarkMain extends ModPrefab
public void postInit(FMLPostInitializationEvent event)
{
super.postInit(event);
//TODO load langs
recipeLoader.loadRecipes();
proxy.postInit();
@ -137,15 +141,15 @@ public class DarkMain extends ModPrefab
/* CONFIGS */
CONFIGURATION.load();
/* BLOCKS */
DarkMain.blockMulti = new BlockMulti(DarkMain.CONFIGURATION.getBlock("MultiBlock", BLOCK_ID_PREFIX++).getInt());
blockMulti = new BlockMulti(DarkMain.CONFIGURATION.getBlock("MultiBlock", BLOCK_ID_PREFIX++).getInt());
if (CONFIGURATION.get("general", "LoadOre", true).getBoolean(true))
{
recipeLoader.blockOre = new BlockOre(BLOCK_ID_PREFIX++, CONFIGURATION);
CoreRecipeLoader.blockOre = new BlockOre(BLOCK_ID_PREFIX++, CONFIGURATION);
}
/* ITEMS */
if (CONFIGURATION.get("general", "LoadOreItems", true).getBoolean(true))
{
recipeLoader.itemMetals = new ItemOreDirv(ITEM_ID_PREFIX++, CONFIGURATION);
CoreRecipeLoader.itemMetals = new ItemOreDirv(ITEM_ID_PREFIX++, CONFIGURATION);
}
if (CONFIGURATION.hasChanged())
{
@ -182,10 +186,10 @@ public class DarkMain extends ModPrefab
{
SaveManager.save(true);
}
@Override
public String getDomain()
{
// TODO Auto-generated method stub
return "dark";
}

View file

@ -17,37 +17,54 @@ public abstract class RecipeLoader
protected static Object steel;
protected static Object steelPlate;
protected static Object motor;
protected static Object bronze;
protected static Object bronzePlate;
static boolean loaded = false;
/** Should be called to load recipes. The main class only loads ore name items to decrease
* chances of missing items in recipes */
public void loadRecipes()
{
/* Vinalla items load first */
circuit = Item.redstoneRepeater;
circuit2 = Item.comparator;
steel = Item.ingotIron;
steelPlate = Item.ingotGold;
motor = Block.pistonBase;
/* Ore directory items load over teh vinalla ones if they are present */
if (OreDictionary.getOres("basicCircuit").size() > 0)
if (!loaded)
{
circuit = "basicCircuit";
}
if (OreDictionary.getOres("advancedCircuit").size() > 0)
{
circuit = "advancedCircuit";
}
if (OreDictionary.getOres("ingotSteel").size() > 0)
{
steel = "ingotSteel";
}
if (OreDictionary.getOres("plateSteel").size() > 0)
{
steelPlate = "plateSteel";
}
if (OreDictionary.getOres("motor").size() > 0)
{
motor = "motor";
/* Vinalla items load first */
circuit = Item.redstoneRepeater;
circuit2 = Item.comparator;
steel = Item.ingotIron;
steelPlate = Item.ingotGold;
motor = Block.pistonBase;
bronze = Item.ingotIron;
bronzePlate = Item.ingotGold;
/* Ore directory items load over teh vinalla ones if they are present */
if (OreDictionary.getOres("basicCircuit").size() > 0)
{
circuit = "basicCircuit";
}
if (OreDictionary.getOres("advancedCircuit").size() > 0)
{
circuit = "advancedCircuit";
}
if (OreDictionary.getOres("ingotSteel").size() > 0)
{
steel = "ingotSteel";
}
if (OreDictionary.getOres("plateSteel").size() > 0)
{
steelPlate = "plateSteel";
}
if (OreDictionary.getOres("motor").size() > 0)
{
motor = "motor";
}
if (OreDictionary.getOres("ingotBronze").size() > 0)
{
bronze = "ingotBronze";
}
if (OreDictionary.getOres("plateBronze").size() > 0)
{
bronzePlate = "plateBronze";
}
}
}