worked a bit on ores and processor ore parser

This commit is contained in:
DarkGuardsman 2013-10-25 05:23:58 -04:00
parent 6a6c751f55
commit 0304fb66f7
4 changed files with 111 additions and 28 deletions

View file

@ -267,19 +267,22 @@ public class ProcessorRecipes
{ {
for (EnumMaterial mat : EnumMaterial.values()) for (EnumMaterial mat : EnumMaterial.values())
{ {
//Items
ItemStack dust = EnumMaterial.getStack(mat, EnumOrePart.DUST, 1); ItemStack dust = EnumMaterial.getStack(mat, EnumOrePart.DUST, 1);
ItemStack scraps = EnumMaterial.getStack(mat, EnumOrePart.SCRAPS, 1); ItemStack scraps = EnumMaterial.getStack(mat, EnumOrePart.SCRAPS, 1);
ItemStack plate = EnumMaterial.getStack(mat, EnumOrePart.PLATES, 1); ItemStack plate = EnumMaterial.getStack(mat, EnumOrePart.PLATES, 1);
ItemStack rubble = EnumMaterial.getStack(mat, EnumOrePart.RUBBLE, 1); ItemStack rubble = EnumMaterial.getStack(mat, EnumOrePart.RUBBLE, 1);
ItemStack rod = EnumMaterial.getStack(mat, EnumOrePart.ROD, 1); ItemStack rod = EnumMaterial.getStack(mat, EnumOrePart.ROD, 1);
ItemStack tube = EnumMaterial.getStack(mat, EnumOrePart.TUBE, 1); ItemStack tube = EnumMaterial.getStack(mat, EnumOrePart.TUBE, 1);
//Ingots
List<ItemStack> ingots = OreDictionary.getOres("ingot" + mat.simpleName); List<ItemStack> ingots = OreDictionary.getOres("ingot" + mat.simpleName);
ingots.addAll(OreDictionary.getOres(mat.simpleName + "ingot")); ingots.addAll(OreDictionary.getOres(mat.simpleName + "ingot"));
//plate
List<ItemStack> plates = OreDictionary.getOres("plate" + mat.simpleName); List<ItemStack> plates = OreDictionary.getOres("plate" + mat.simpleName);
ingots.addAll(OreDictionary.getOres(mat.simpleName + "plate")); ingots.addAll(OreDictionary.getOres(mat.simpleName + "plate"));
//ore
List<ItemStack> ores = OreDictionary.getOres("ore" + mat.simpleName);
ingots.addAll(OreDictionary.getOres(mat.simpleName + "ore"));
for (ItemStack ing : ingots) for (ItemStack ing : ingots)
{ {
@ -311,6 +314,21 @@ public class ProcessorRecipes
scraps.stackSize = 1; scraps.stackSize = 1;
} }
} }
for (ItemStack ore : ores)
{
if (mat.shouldCreateItem(EnumOrePart.RUBBLE))
{
rubble.stackSize = 2;
ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, ore, rubble);
rubble.stackSize = 1;
}
if(mat.shouldCreateItem(EnumOrePart.DUST))
{
dust.stackSize = 2;
ProcessorRecipes.createRecipe(ProcessorType.GRINDER, ore, dust);
dust.stackSize = 1;
}
}
} }
loadedOres = true; loadedOres = true;

View file

@ -62,7 +62,7 @@ public class CoreRecipeLoader extends RecipeLoader
} }
if (blockWire instanceof BlockWire) if (blockWire instanceof BlockWire)
{ {
new RecipeGrid(new ItemStack(blockWire, 1, 0), 3, 1).setRowOne(Block.cloth, Block.cloth, Block.cloth).setRowTwo(copper, copper, copper).setRowThree(Block.cloth, Block.cloth, Block.cloth).RegisterRecipe(); new RecipeGrid(new ItemStack(blockWire, 1, 0), 3, 3).setRowOne(Block.cloth, Block.cloth, Block.cloth).setRowTwo(copper, copper, copper).setRowThree(Block.cloth, Block.cloth, Block.cloth).RegisterRecipe();
} }
this.loadParts(); this.loadParts();
} }
@ -122,16 +122,7 @@ public class CoreRecipeLoader extends RecipeLoader
ItemStack rubble = EnumMaterial.getStack(mat, EnumOrePart.RUBBLE, 1); ItemStack rubble = EnumMaterial.getStack(mat, EnumOrePart.RUBBLE, 1);
ItemStack rod = EnumMaterial.getStack(mat, EnumOrePart.ROD, 1); ItemStack rod = EnumMaterial.getStack(mat, EnumOrePart.ROD, 1);
ItemStack tube = EnumMaterial.getStack(mat, EnumOrePart.TUBE, 1); ItemStack tube = EnumMaterial.getStack(mat, EnumOrePart.TUBE, 1);
if (mat.shouldCreateItem(EnumOrePart.INGOTS))
{
OreDictionary.registerOre(mat.simpleName + "ingot", ingot);
OreDictionary.registerOre("ingot" + mat.simpleName, ingot);
}
if (mat.shouldCreateItem(EnumOrePart.RUBBLE))
{
OreDictionary.registerOre(mat.simpleName + "rubble", rubble);
OreDictionary.registerOre("rubble" + mat.simpleName, rubble);
}
if (mat.shouldCreateTool()) if (mat.shouldCreateTool())
{ {
new RecipeGrid(mat.getTool(EnumTool.PICKAX)).setRowOne(ingot, ingot, ingot).setRowTwo(null, Item.stick, null).setRowThree(null, Item.stick, null).RegisterRecipe(); new RecipeGrid(mat.getTool(EnumTool.PICKAX)).setRowOne(ingot, ingot, ingot).setRowTwo(null, Item.stick, null).setRowThree(null, Item.stick, null).RegisterRecipe();
@ -155,8 +146,6 @@ public class CoreRecipeLoader extends RecipeLoader
dust.stackSize = 1; dust.stackSize = 1;
ProcessorRecipes.createRecipe(ProcessorType.GRINDER, rod, dust); ProcessorRecipes.createRecipe(ProcessorType.GRINDER, rod, dust);
ProcessorRecipes.createRecipe(ProcessorType.GRINDER, tube, dust); ProcessorRecipes.createRecipe(ProcessorType.GRINDER, tube, dust);
OreDictionary.registerOre(mat.simpleName + "dust", dust);
OreDictionary.registerOre("dust" + mat.simpleName, dust);
} }
// Salvaging recipe // Salvaging recipe
@ -173,8 +162,6 @@ public class CoreRecipeLoader extends RecipeLoader
ProcessorRecipes.createSalvageDamageOutput(ProcessorType.CRUSHER, ingot, scraps); ProcessorRecipes.createSalvageDamageOutput(ProcessorType.CRUSHER, ingot, scraps);
ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, rod, scraps); ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, rod, scraps);
ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, tube, scraps); ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, tube, scraps);
OreDictionary.registerOre(mat.simpleName + "scraps", scraps);
OreDictionary.registerOre("scraps" + mat.simpleName, scraps);
} }
ingot.stackSize = 1; ingot.stackSize = 1;
@ -184,8 +171,6 @@ public class CoreRecipeLoader extends RecipeLoader
new RecipeGrid(tube, 3, 1).setRowOne(ingot, ingot, ingot).RegisterRecipe(); new RecipeGrid(tube, 3, 1).setRowOne(ingot, ingot, ingot).RegisterRecipe();
tube.stackSize = 1; tube.stackSize = 1;
new RecipeGrid(tube, 1, 1).setRowOne(rod).RegisterRecipe(); new RecipeGrid(tube, 1, 1).setRowOne(rod).RegisterRecipe();
OreDictionary.registerOre(mat.simpleName + "tube", tube);
OreDictionary.registerOre("tube" + mat.simpleName, tube);
} }
if (mat.shouldCreateItem(EnumOrePart.ROD)) if (mat.shouldCreateItem(EnumOrePart.ROD))
@ -193,20 +178,14 @@ public class CoreRecipeLoader extends RecipeLoader
rod.stackSize = 2; rod.stackSize = 2;
new RecipeGrid(rod, 2, 1).setRowOne(ingot, ingot).RegisterRecipe(); new RecipeGrid(rod, 2, 1).setRowOne(ingot, ingot).RegisterRecipe();
rod.stackSize = 1; rod.stackSize = 1;
OreDictionary.registerOre(mat.simpleName + "rod", rod);
OreDictionary.registerOre("rod" + mat.simpleName, rod);
} }
if (mat.shouldCreateItem(EnumOrePart.PLATES)) if (mat.shouldCreateItem(EnumOrePart.PLATES))
{ {
new RecipeGrid(mat.getStack(EnumOrePart.PLATES, 1), 2, 2).setRowOne(ingot, ingot).setRowTwo(ingot, ingot).RegisterRecipe(); new RecipeGrid(mat.getStack(EnumOrePart.PLATES, 1), 2, 2).setRowOne(ingot, ingot).setRowTwo(ingot, ingot).RegisterRecipe();
OreDictionary.registerOre(mat.simpleName + "plate", plates);
OreDictionary.registerOre("plate" + mat.simpleName, plates);
} }
if (mat.shouldCreateItem(EnumOrePart.GEARS)) if (mat.shouldCreateItem(EnumOrePart.GEARS))
{ {
new RecipeGrid(mat.getStack(EnumOrePart.GEARS, 4), 3, 3).setRowOne(null, ingot, null).setRowTwo(ingot, (mat.shouldCreateItem(EnumOrePart.ROD) ? rod : Item.stick), ingot).setRowThree(null, ingot, null).RegisterRecipe(); new RecipeGrid(mat.getStack(EnumOrePart.GEARS, 4), 3, 3).setRowOne(null, ingot, null).setRowTwo(ingot, (mat.shouldCreateItem(EnumOrePart.ROD) ? rod : Item.stick), ingot).setRowThree(null, ingot, null).RegisterRecipe();
OreDictionary.registerOre(mat.simpleName + "gear", mat.getStack(EnumOrePart.GEARS, 1));
OreDictionary.registerOre("gear" + mat.simpleName, mat.getStack(EnumOrePart.GEARS, 1));
} }
} }
@ -219,7 +198,9 @@ public class CoreRecipeLoader extends RecipeLoader
if (CoreRecipeLoader.itemMetals instanceof ItemOreDirv) if (CoreRecipeLoader.itemMetals instanceof ItemOreDirv)
{ {
FurnaceRecipes.smelting().addSmelting(blockOre.blockID, data.ordinal(), EnumMaterial.getStack(data.mat, EnumOrePart.INGOTS, 1), 0.6f); FurnaceRecipes.smelting().addSmelting(blockOre.blockID, data.ordinal(), EnumMaterial.getStack(data.mat, EnumOrePart.INGOTS, 1), 0.6f);
ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, new ItemStack(blockOre.blockID, 1, data.ordinal()), EnumMaterial.getStack(data.mat, EnumOrePart.RUBBLE, 1)); ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, new ItemStack(blockOre.blockID, 1, data.ordinal()), EnumMaterial.getStack(data.mat, EnumOrePart.RUBBLE, 2));
ProcessorRecipes.createRecipe(ProcessorType.GRINDER, new ItemStack(blockOre.blockID, 1, data.ordinal()), EnumMaterial.getStack(data.mat, EnumOrePart.DUST, 2));
} }
} }
} }

View file

@ -5,10 +5,13 @@ import java.io.File;
import java.util.Arrays; import java.util.Arrays;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraftforge.common.Configuration; import net.minecraftforge.common.Configuration;
import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.oredict.OreDictionary;
import universalelectricity.prefab.TranslationHelper; import universalelectricity.prefab.TranslationHelper;
import universalelectricity.prefab.ore.OreGenReplaceStone; import universalelectricity.prefab.ore.OreGenReplaceStone;
import universalelectricity.prefab.ore.OreGenerator; import universalelectricity.prefab.ore.OreGenerator;
@ -28,6 +31,9 @@ import cpw.mods.fml.common.event.FMLServerStoppingEvent;
import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import dark.api.ProcessorRecipes;
import dark.api.ProcessorRecipes.ProcessorType;
import dark.core.common.RecipeLoader.RecipeGrid;
import dark.core.common.blocks.BlockBasalt; import dark.core.common.blocks.BlockBasalt;
import dark.core.common.blocks.BlockColorGlass; import dark.core.common.blocks.BlockColorGlass;
import dark.core.common.blocks.BlockColorGlowGlass; import dark.core.common.blocks.BlockColorGlowGlass;
@ -39,6 +45,7 @@ import dark.core.common.blocks.ItemBlockOre;
import dark.core.common.debug.BlockDebug; import dark.core.common.debug.BlockDebug;
import dark.core.common.items.EnumMaterial; import dark.core.common.items.EnumMaterial;
import dark.core.common.items.EnumOrePart; import dark.core.common.items.EnumOrePart;
import dark.core.common.items.EnumTool;
import dark.core.common.items.ItemBattery; import dark.core.common.items.ItemBattery;
import dark.core.common.items.ItemColoredDust; import dark.core.common.items.ItemColoredDust;
import dark.core.common.items.ItemCommonTool; import dark.core.common.items.ItemCommonTool;
@ -135,6 +142,75 @@ public class DarkMain extends ModPrefab
} }
} }
} }
if (CoreRecipeLoader.blockWire instanceof BlockWire)
{
OreDictionary.registerOre("copperwire", new ItemStack(CoreRecipeLoader.blockWire, 1, 0));
OreDictionary.registerOre("wirecopper", new ItemStack(CoreRecipeLoader.blockWire, 1, 0));
}
if (CoreRecipeLoader.itemMetals instanceof ItemOreDirv)
{
//Ore material recipe loop
for (EnumMaterial mat : EnumMaterial.values())
{
ItemStack dust = EnumMaterial.getStack(mat, EnumOrePart.DUST, 1);
ItemStack ingot = EnumMaterial.getStack(mat, EnumOrePart.INGOTS, 1);
ItemStack scraps = EnumMaterial.getStack(mat, EnumOrePart.SCRAPS, 1);
ItemStack plates = EnumMaterial.getStack(mat, EnumOrePart.PLATES, 1);
ItemStack rubble = EnumMaterial.getStack(mat, EnumOrePart.RUBBLE, 1);
ItemStack rod = EnumMaterial.getStack(mat, EnumOrePart.ROD, 1);
ItemStack tube = EnumMaterial.getStack(mat, EnumOrePart.TUBE, 1);
if (mat.shouldCreateItem(EnumOrePart.INGOTS))
{
OreDictionary.registerOre(mat.simpleName + "ingot", ingot);
OreDictionary.registerOre("ingot" + mat.simpleName, ingot);
}
if (mat.shouldCreateItem(EnumOrePart.RUBBLE))
{
OreDictionary.registerOre(mat.simpleName + "rubble", rubble);
OreDictionary.registerOre("rubble" + mat.simpleName, rubble);
}
//Dust recipes
if (mat.shouldCreateItem(EnumOrePart.DUST))
{
OreDictionary.registerOre(mat.simpleName + "dust", dust);
OreDictionary.registerOre("dust" + mat.simpleName, dust);
}
// Salvaging recipe
if (mat.shouldCreateItem(EnumOrePart.SCRAPS))
{
OreDictionary.registerOre(mat.simpleName + "scraps", scraps);
OreDictionary.registerOre("scraps" + mat.simpleName, scraps);
}
ingot.stackSize = 1;
if (mat.shouldCreateItem(EnumOrePart.TUBE))
{
OreDictionary.registerOre(mat.simpleName + "tube", tube);
OreDictionary.registerOre("tube" + mat.simpleName, tube);
}
if (mat.shouldCreateItem(EnumOrePart.ROD))
{
OreDictionary.registerOre(mat.simpleName + "rod", rod);
OreDictionary.registerOre("rod" + mat.simpleName, rod);
}
if (mat.shouldCreateItem(EnumOrePart.PLATES))
{
OreDictionary.registerOre(mat.simpleName + "plate", plates);
OreDictionary.registerOre("plate" + mat.simpleName, plates);
}
if (mat.shouldCreateItem(EnumOrePart.GEARS))
{
OreDictionary.registerOre(mat.simpleName + "gear", mat.getStack(EnumOrePart.GEARS, 1));
OreDictionary.registerOre("gear" + mat.simpleName, mat.getStack(EnumOrePart.GEARS, 1));
}
}
}
FMLLog.info(" Loaded: " + TranslationHelper.loadLanguages(LANGUAGE_PATH, LANGUAGES_SUPPORTED) + " Languages."); FMLLog.info(" Loaded: " + TranslationHelper.loadLanguages(LANGUAGE_PATH, LANGUAGES_SUPPORTED) + " Languages.");
proxy.init(); proxy.init();
} }

View file

@ -35,6 +35,8 @@ public class BlockOre extends Block implements IExtraBlockInfo
super(DarkMain.CONFIGURATION.getBlock("Ore", ModPrefab.getNextID()).getInt(), Material.rock); super(DarkMain.CONFIGURATION.getBlock("Ore", ModPrefab.getNextID()).getInt(), Material.rock);
this.setCreativeTab(CreativeTabs.tabBlock); this.setCreativeTab(CreativeTabs.tabBlock);
this.setUnlocalizedName(DarkMain.getInstance().PREFIX + "Ore"); this.setUnlocalizedName(DarkMain.getInstance().PREFIX + "Ore");
this.setHardness(2.5f);
this.setResistance(5.0f);
for (OreData data : OreData.values()) for (OreData data : OreData.values())
{ {
@ -42,6 +44,12 @@ public class BlockOre extends Block implements IExtraBlockInfo
} }
} }
@Override
public int damageDropped(int par1)
{
return par1;
}
@Override @Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{ {