Added item parts from Fluid Mechanics

This is not only to move the crafting parts to the core, but as well to
reduce down the need to create another part class for future items.
This commit is contained in:
DarkGuardsman 2013-08-26 14:16:16 -04:00
parent e0bd6c3796
commit 87bf46a2b6
3 changed files with 75 additions and 14 deletions

View file

@ -4,10 +4,9 @@ import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import dark.core.RecipeLoader.RecipeGrid;
import dark.core.items.EnumMeterials;
import dark.core.items.EnumOreParts;
import dark.core.items.ItemTools;
import dark.core.items.ItemParts.Parts;
import dark.core.items.ItemWrench;
public class CoreRecipeLoader extends RecipeLoader
@ -17,16 +16,55 @@ public class CoreRecipeLoader extends RecipeLoader
public static Block blockOre, blockDebug, blockWire;
/* ITEMS */
public static Item itemMetals, battery, itemTool;
public static Item itemMetals, battery, itemTool, itemParts;
public static ItemWrench wrench;
public static ItemStack ironTube, bronzeTube, obbyTube, netherTube;
public static ItemStack leatherSeal, slimeSeal;
public static ItemStack valvePart;
public static ItemStack unfinishedTank;
@Override
public void loadRecipes()
{
super.loadRecipes();
new RecipeGrid(new ItemStack(itemTool, 1, 0), 3, 2).setRowOne("ironTube", "valvePart", "ironTube").setRowTwo(null, "ironTube", null).RegisterRecipe();
loadSmeltingRecipes();
this.loadSmeltingRecipes();
this.loadParts();
}
public void loadParts()
{
if (itemParts != null)
{
ironTube = new ItemStack(itemParts, 1, Parts.Iron.ordinal());
bronzeTube = new ItemStack(itemParts, 1, Parts.Bronze.ordinal());
obbyTube = new ItemStack(itemParts, 1, Parts.Obby.ordinal());
netherTube = new ItemStack(itemParts, 1, Parts.Nether.ordinal());
leatherSeal = new ItemStack(itemParts, 1, Parts.Seal.ordinal());
slimeSeal = new ItemStack(itemParts, 1, Parts.SlimeSeal.ordinal());
valvePart = new ItemStack(itemParts, 1, Parts.Tank.ordinal());
unfinishedTank = new ItemStack(itemParts, 1, Parts.Tank.ordinal());
// iron tube
new RecipeGrid(this.setStackSize(ironTube, 4), 3, 1).setRowOne(Item.ingotIron, Item.ingotIron, Item.ingotIron).RegisterRecipe();
// bronze tube
new RecipeGrid(this.setStackSize(bronzeTube, 4), 3, 1).setRowOne("ingotBronze", "ingotBronze", "ingotBronze").RegisterRecipe();
// obby tube
new RecipeGrid(this.setStackSize(obbyTube, 4), 3, 1).setRowOne(Block.obsidian, Block.obsidian, Block.obsidian).RegisterRecipe();
// nether tube
new RecipeGrid(this.setStackSize(netherTube, 4), 3, 1).setRowOne(Block.netherrack, Block.netherrack, Block.netherrack).RegisterRecipe();
// seal
new RecipeGrid(this.setStackSize(leatherSeal, 16), 2, 2).setRowOne(Item.leather, Item.leather).setRowTwo(Item.leather, Item.leather).RegisterRecipe();
// slime steal
new RecipeGrid(this.setStackSize(slimeSeal, 4)).setRowOne(null, leatherSeal, null).setRowTwo(leatherSeal, Item.slimeBall, leatherSeal).setRowThree(null, leatherSeal, null).RegisterRecipe();
// part valve
new RecipeGrid(valvePart, 3, 1).setRowOne(ironTube, Block.lever, ironTube).RegisterRecipe();
// unfinished tank
new RecipeGrid(unfinishedTank).setRowOne(null, Item.ingotIron, null).setRowTwo(Item.ingotIron, null, Item.ingotIron).setRowThree(null, Item.ingotIron, null).RegisterRecipe();
new RecipeGrid(unfinishedTank).setRowOne(null, bronze, null).setRowTwo(bronze, null, bronze).setRowThree(null, bronze, null).RegisterRecipe();
}
}
public void loadSmeltingRecipes()

View file

@ -3,10 +3,12 @@ package dark.core;
import java.io.File;
import java.util.Arrays;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.oredict.OreDictionary;
import universalelectricity.prefab.network.PacketManager;
import universalelectricity.prefab.ore.OreGenReplaceStone;
import universalelectricity.prefab.ore.OreGenerator;
@ -36,6 +38,8 @@ import dark.core.items.ItemBattery;
import dark.core.items.ItemBlockHolder;
import dark.core.items.ItemOre;
import dark.core.items.ItemOreDirv;
import dark.core.items.ItemParts;
import dark.core.items.ItemParts.Parts;
import dark.core.items.ItemTools;
import dark.core.items.ItemWrench;
@ -134,6 +138,20 @@ public class DarkMain extends ModPrefab
GameRegistry.registerTileEntity(debugBlocks.values()[i].clazz, "DMDebug" + i);
}
}
if (CoreRecipeLoader.itemParts != null)
{
/* ORE DIRECTORY REGISTER */
OreDictionary.registerOre("bronzeTube", new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Bronze.ordinal()));
OreDictionary.registerOre("ironTube", new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Iron.ordinal()));
OreDictionary.registerOre("netherTube", new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Nether.ordinal()));
OreDictionary.registerOre("obbyTube", new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Obby.ordinal()));
OreDictionary.registerOre("leatherSeal", new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Seal.ordinal()));
OreDictionary.registerOre("leatherSlimeSeal", new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.SlimeSeal.ordinal()));
OreDictionary.registerOre("valvePart", new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Valve.ordinal()));
OreDictionary.registerOre("bronzeTube", new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Bronze.ordinal()));
OreDictionary.registerOre("unfinishedTank", new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Tank.ordinal()));
}
//TODO look at possibility of having this only be enabled if needed but still no option to disable manually
GameRegistry.registerBlock(blockMulti, "multiBlock");
GameRegistry.registerTileEntity(TileEntityMulti.class, "DMMultiBlock");
@ -182,6 +200,8 @@ public class DarkMain extends ModPrefab
{
CoreRecipeLoader.itemMetals = new ItemOreDirv(ITEM_ID_PREFIX++, CONFIGURATION);
}
CoreRecipeLoader.itemParts = new ItemParts(ITEM_ID_PREFIX++, CONFIGURATION);
if (CONFIGURATION.get("general", "EnableBattery", true).getBoolean(true))
{
CoreRecipeLoader.battery = new ItemBattery("Battery", ITEM_ID_PREFIX++);

View file

@ -6,17 +6,21 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.Configuration;
/** Parts that are used for crafting higher up items and block. These parts have no use other that
* crafting
*
* @author DarkGuardsman */
/** A metadata item containing parts of various machines in Liquid Mechanics Mod.
*
* @author Rs */
public class ItemParts extends ItemBasic
{
public enum Parts
{
VALVE("Valve"),
SERVO("Servo");
Bronze("BronzeTube"),
Iron("IronTube"),
Obby("ObbyTube"),
Nether("NetherTube"),
Seal("LeatherSeal"),
SlimeSeal("SlimeSeal"),
Tank("UnfinishedTank"),
Valve("ValvePart");
public String name;
@ -26,9 +30,9 @@ public class ItemParts extends ItemBasic
}
}
public ItemParts(int itemID, Configuration config)
public ItemParts(int par1, Configuration config)
{
super(itemID, "lmPart", config);
super(par1,"DMParts", config);
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setMaxStackSize(64);
@ -55,5 +59,4 @@ public class ItemParts extends ItemBasic
par3List.add(new ItemStack(this, 1, i));
}
}
}