Added to the ore parser and added configs for it

Since i added way to force other mods items to convert to mine i added
config to prevent this. In the rare case that a mod has an oreXXX that
doesn't convert to ingotXXX
This commit is contained in:
DarkGuardsman 2013-10-25 21:57:08 -04:00
parent 7c718fe908
commit c22c3fb9be
3 changed files with 32 additions and 4 deletions

View file

@ -8,12 +8,14 @@ import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.oredict.OreDictionary;
import com.builtbroken.common.Pair;
import cpw.mods.fml.common.registry.GameRegistry;
import dark.core.common.CoreRecipeLoader;
import dark.core.common.DarkMain;
import dark.core.common.items.EnumMaterial;
import dark.core.common.items.EnumOrePart;
import dark.core.common.items.ItemOreDirv;
@ -261,7 +263,7 @@ public class ProcessorRecipes
return reList;
}
public static void parseOreNames()
public static void parseOreNames(Configuration config)
{
if (!loadedOres && CoreRecipeLoader.itemMetals instanceof ItemOreDirv)
{
@ -283,6 +285,16 @@ public class ProcessorRecipes
//ore
List<ItemStack> ores = OreDictionary.getOres("ore" + mat.simpleName);
ingots.addAll(OreDictionary.getOres(mat.simpleName + "ore"));
//dust
List<ItemStack> dusts = OreDictionary.getOres("dust" + mat.simpleName);
ingots.addAll(OreDictionary.getOres(mat.simpleName + "dust"));
for (ItemStack du : dusts)
{
if (mat.shouldCreateItem(EnumOrePart.INGOTS) && config.get("OreParser", "OverrideDustSmelthing", true).getBoolean(true))
{
FurnaceRecipes.smelting().addSmelting(du.itemID, du.getItemDamage(), mat.getStack(EnumOrePart.INGOTS, 1), 0.6f);
}
}
for (ItemStack ing : ingots)
{
@ -296,6 +308,10 @@ public class ProcessorRecipes
ProcessorRecipes.createSalvageDamageOutput(ProcessorType.CRUSHER, ing, scraps);
ProcessorRecipes.createSalvageDamageOutput(ProcessorType.CRUSHER, ing, scraps);
}
if (mat.shouldCreateItem(EnumOrePart.INGOTS))
{
GameRegistry.addShapelessRecipe(mat.getStack(EnumOrePart.INGOTS, 1), new Object[] { ing });
}
}
for (ItemStack pla : plates)
{
@ -313,6 +329,14 @@ public class ProcessorRecipes
ProcessorRecipes.createSalvageDamageOutput(ProcessorType.CRUSHER, pla, scraps);
scraps.stackSize = 1;
}
if (mat.shouldCreateItem(EnumOrePart.PLATES))
{
GameRegistry.addShapelessRecipe(mat.getStack(EnumOrePart.PLATES, 1), new Object[] { pla });
if (config.get("OreParser", "ForcePlateToIngotDM", true).getBoolean(true))
{
GameRegistry.addShapelessRecipe(mat.getStack(EnumOrePart.INGOTS, 4), new Object[] { pla });
}
}
}
for (ItemStack ore : ores)
{
@ -322,12 +346,16 @@ public class ProcessorRecipes
ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, ore, rubble);
rubble.stackSize = 1;
}
if(mat.shouldCreateItem(EnumOrePart.DUST))
if (mat.shouldCreateItem(EnumOrePart.DUST))
{
dust.stackSize = 2;
ProcessorRecipes.createRecipe(ProcessorType.GRINDER, ore, dust);
dust.stackSize = 1;
}
if (mat.shouldCreateItem(EnumOrePart.INGOTS) && config.get("OreParser", "OverrideOreSmelthing", true).getBoolean(true))
{
FurnaceRecipes.smelting().addSmelting(ore.itemID, ore.getItemDamage(), mat.getStack(EnumOrePart.INGOTS, 1), 0.6f);
}
}
}

View file

@ -229,6 +229,7 @@ public class DarkMain extends ModPrefab
{
DMCreativeTab.tabIndustrial.itemStack = EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.GEARS, 1);
}
ProcessorRecipes.parseOreNames(CONFIGURATION);
}
@Override

View file

@ -103,7 +103,6 @@ public abstract class ModPrefab
@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
ProcessorRecipes.parseOreNames();
this.loadRecipes();
}