moved tools, and parts to core

This was planned to give more options to the other sub mods of the core.
The parts item will be expanded adding more and more sub items for
crafting. The tool was already expanded to add a multi-meter.
This commit is contained in:
DarkGuardsman 2013-08-26 14:25:27 -04:00
parent 150d76038c
commit fa33b00e58
5 changed files with 16 additions and 265 deletions

View file

@ -6,8 +6,9 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
import cpw.mods.fml.common.registry.GameRegistry;
import dark.api.ColorCode;
import dark.core.CoreRecipeLoader;
import dark.core.RecipeLoader;
import dark.fluid.common.item.ItemParts.Parts;
import dark.core.items.ItemParts.Parts;
import dark.fluid.common.machines.BlockFluid;
public class FMRecipeLoader extends RecipeLoader
@ -29,17 +30,6 @@ public class FMRecipeLoader extends RecipeLoader
public static BlockFluid blockFuelLiquid;
/* ITEMS */
public static Item itemParts;
public static Item itemGauge;
public static ItemStack ironTube;
public static ItemStack bronzeTube;
public static ItemStack obbyTube;
public static ItemStack netherTube;
public static ItemStack leatherSeal;
public static ItemStack slimeSeal;
public static ItemStack valvePart;
public static ItemStack unfinishedTank;
public static ItemStack ironPipe;
public static ItemStack bronzePipe;
@ -53,68 +43,34 @@ public class FMRecipeLoader extends RecipeLoader
@Override
public void loadRecipes()
{
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());
ironPipe = new ItemStack(blockGenPipe, 1, 15);
bronzePipe = new ItemStack(blockPipe, 4, ColorCode.ORANGE.ordinal());
this.registerItems();
this.registerPipes();
this.registerTanks();
// generator
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(this.blockGenerator, 1), new Object[] { "@T@", "OVO", "@T@", 'T', new ItemStack(blockRod, 1), '@', "plateSteel", 'O', "basicCircuit", 'V', "motor" }));
// mechanical rod
GameRegistry.addRecipe(new ItemStack(blockRod, 1), new Object[] { "I@I", 'I', Item.ingotIron, '@', new ItemStack(itemParts, 1, Parts.Iron.ordinal()) });
// pipe gauge
new RecipeGrid(itemGauge, 3, 2).setRowOne("ironTube", "valvePart", "ironTube").setRowTwo(null, "ironTube", null).RegisterRecipe();
GameRegistry.addRecipe(new ItemStack(blockRod, 1), new Object[] { "I@I", 'I', Item.ingotIron, '@', new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Iron.ordinal()) });
// white pipe crafting -- has to be separate since iron pipe is #15 instead of white
GameRegistry.addRecipe(new ItemStack(blockGenPipe, 4, ColorCode.WHITE.ordinal()), new Object[] { " P ", "PCP", " P ", 'P', blockGenPipe, 'C', new ItemStack(Item.dyePowder, 1, 15) });
// pump
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockMachine, 1, 0), new Object[] { "C@C", "BMB", "@X@", '@', "plateSteel", 'X', new ItemStack(blockPipe, 1), 'B', new ItemStack(itemParts, 1, Parts.Valve.ordinal()), 'C', "basicCircuit", 'M', "motor" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockMachine, 1, 0), new Object[] { "C@C", "BMB", "@X@", '@', "plateSteel", 'X', new ItemStack(blockPipe, 1), 'B', new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Valve.ordinal()), 'C', "basicCircuit", 'M', "motor" }));
// construction pump
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockConPump, 1, 0), new Object[] { "@C@", "BMB", "@@@", '@', "plateSteel", 'B', new ItemStack(itemParts, 1, Parts.Valve.ordinal()), 'C', "advancedCircuit", 'M', "motor" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockConPump, 1, 0), new Object[] { "@C@", "BMB", "@@@", '@', "plateSteel", 'B', new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Valve.ordinal()), 'C', "advancedCircuit", 'M', "motor" }));
// Drain
GameRegistry.addRecipe(new ItemStack(blockDrain, 1, 0), new Object[] { "IGI", "SVS", " P ", 'I', Item.ingotIron, 'G', Block.dispenser, 'S', Block.stone, 'P', new ItemStack(blockPipe, 1), 'V', new ItemStack(itemParts, 1, Parts.Valve.ordinal()) });
GameRegistry.addRecipe(new ItemStack(blockDrain, 1, 0), new Object[] { "IGI", "SVS", " P ", 'I', Item.ingotIron, 'G', Block.dispenser, 'S', Block.stone, 'P', new ItemStack(blockPipe, 1), 'V', new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Valve.ordinal()) });
// release valve
GameRegistry.addRecipe(new ItemStack(blockReleaseValve, 1), new Object[] { "RPR", "PVP", "RPR", 'P', new ItemStack(blockPipe, 1), 'V', new ItemStack(itemParts, 1, Parts.Valve.ordinal()), 'R', Item.redstone });
GameRegistry.addRecipe(new ItemStack(blockReleaseValve, 1), new Object[] { "RPR", "PVP", "RPR", 'P', new ItemStack(blockPipe, 1), 'V', new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Valve.ordinal()), 'R', Item.redstone });
// sink
GameRegistry.addRecipe(new ItemStack(blockSink, 1), new Object[] { "I I", "SIS", "SPS", 'P', new ItemStack(blockPipe, 1), 'I', Item.ingotIron, 'S', Block.stone });
GameRegistry.addRecipe(new ItemStack(blockSink, 1), new Object[] { "I I", "SIS", "SPS", 'P', new ItemStack(blockGenPipe, 1), 'I', Item.ingotIron, 'S', Block.stone });
}
public void registerItems()
{
// 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 registerTanks()
{
// lava tank
@ -130,20 +86,20 @@ public class FMRecipeLoader extends RecipeLoader
public void registerPipes()
{
// Iron Pipe
GameRegistry.addShapelessRecipe(ironPipe, new Object[] { ironTube, leatherSeal });
GameRegistry.addShapelessRecipe(ironPipe, new Object[] { CoreRecipeLoader.ironTube, CoreRecipeLoader.leatherSeal });
// Lava Tube
new RecipeGrid(new ItemStack(blockPipe, 1, ColorCode.RED.ordinal()), 3, 1).setRowOne(netherTube, obbyTube, netherTube).RegisterRecipe();
new RecipeGrid(new ItemStack(blockPipe, 1, ColorCode.RED.ordinal()), 3, 1).setRowOne(CoreRecipeLoader.netherTube, CoreRecipeLoader.obbyTube, CoreRecipeLoader.netherTube).RegisterRecipe();
// fuel pipe
GameRegistry.addShapelessRecipe(new ItemStack(blockPipe, 4, ColorCode.YELLOW.ordinal()), new Object[] { new ItemStack(blockGenPipe, 1, ColorCode.YELLOW.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.YELLOW.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.YELLOW.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.YELLOW.ordinal()), new ItemStack(itemParts, 1, Parts.SlimeSeal.ordinal()) });
GameRegistry.addShapelessRecipe(new ItemStack(blockPipe, 4, ColorCode.YELLOW.ordinal()), new Object[] { new ItemStack(blockGenPipe, 1, ColorCode.YELLOW.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.YELLOW.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.YELLOW.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.YELLOW.ordinal()), new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.SlimeSeal.ordinal()) });
// oil pipe
GameRegistry.addShapelessRecipe(new ItemStack(blockPipe, 4, ColorCode.BLACK.ordinal()), new Object[] { new ItemStack(blockGenPipe, 1, ColorCode.BLACK.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.BLACK.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.BLACK.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.BLACK.ordinal()), new ItemStack(itemParts, 1, Parts.SlimeSeal.ordinal()) });
GameRegistry.addShapelessRecipe(new ItemStack(blockPipe, 4, ColorCode.BLACK.ordinal()), new Object[] { new ItemStack(blockGenPipe, 1, ColorCode.BLACK.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.BLACK.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.BLACK.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.BLACK.ordinal()), new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.SlimeSeal.ordinal()) });
// water pipe
GameRegistry.addShapelessRecipe(new ItemStack(blockPipe, 4, ColorCode.BLUE.ordinal()), new Object[] { new ItemStack(blockGenPipe, 1, ColorCode.BLUE.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.BLUE.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.BLUE.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.BLUE.ordinal()), new ItemStack(itemParts, 1, Parts.SlimeSeal.ordinal()) });
GameRegistry.addShapelessRecipe(new ItemStack(blockPipe, 4, ColorCode.BLUE.ordinal()), new Object[] { new ItemStack(blockGenPipe, 1, ColorCode.BLUE.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.BLUE.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.BLUE.ordinal()), new ItemStack(blockGenPipe, 1, ColorCode.BLUE.ordinal()), new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.SlimeSeal.ordinal()) });
// bronze pipes
GameRegistry.addShapelessRecipe(bronzePipe, new Object[] { bronzeTube, slimeSeal });
GameRegistry.addShapelessRecipe(bronzePipe, new Object[] { CoreRecipeLoader.bronzeTube, CoreRecipeLoader.slimeSeal });
// generic pipe crafting
for (int pipeMeta = 0; pipeMeta < 15; pipeMeta++)
{

View file

@ -30,9 +30,8 @@ import cpw.mods.fml.common.registry.GameRegistry;
import dark.core.DarkMain;
import dark.core.ModPrefab;
import dark.core.items.ItemBlockHolder;
import dark.fluid.common.item.ItemParts;
import dark.fluid.common.item.ItemParts.Parts;
import dark.fluid.common.item.ItemTools;
import dark.core.items.ItemParts;
import dark.core.items.ItemParts.Parts;
import dark.fluid.common.machines.BlockFluid;
import dark.fluid.common.machines.BlockReleaseValve;
import dark.fluid.common.machines.BlockSink;
@ -44,7 +43,6 @@ import dark.fluid.common.pipes.BlockPipe;
import dark.fluid.common.pipes.ItemBlockPipe;
import dark.fluid.common.pipes.TileEntityGenericPipe;
import dark.fluid.common.pipes.TileEntityPipe;
import dark.fluid.common.pipes.addon.TileEntityPipeWindow;
import dark.fluid.common.pump.BlockConstructionPump;
import dark.fluid.common.pump.BlockDrain;
import dark.fluid.common.pump.BlockPumpMachine;
@ -130,16 +128,6 @@ public class FluidMech extends ModPrefab
/* LANG LOADING */
FMLog.info(" Loaded: " + TranslationHelper.loadLanguages(LANGUAGE_PATH, LANGUAGES_SUPPORTED) + " Languages.");
/* ORE DIRECTORY REGISTER */
OreDictionary.registerOre("bronzeTube", new ItemStack(FMRecipeLoader.itemParts, 1, Parts.Bronze.ordinal()));
OreDictionary.registerOre("ironTube", new ItemStack(FMRecipeLoader.itemParts, 1, Parts.Iron.ordinal()));
OreDictionary.registerOre("netherTube", new ItemStack(FMRecipeLoader.itemParts, 1, Parts.Nether.ordinal()));
OreDictionary.registerOre("obbyTube", new ItemStack(FMRecipeLoader.itemParts, 1, Parts.Obby.ordinal()));
OreDictionary.registerOre("leatherSeal", new ItemStack(FMRecipeLoader.itemParts, 1, Parts.Seal.ordinal()));
OreDictionary.registerOre("leatherSlimeSeal", new ItemStack(FMRecipeLoader.itemParts, 1, Parts.SlimeSeal.ordinal()));
OreDictionary.registerOre("valvePart", new ItemStack(FMRecipeLoader.itemParts, 1, Parts.Valve.ordinal()));
OreDictionary.registerOre("bronzeTube", new ItemStack(FMRecipeLoader.itemParts, 1, Parts.Bronze.ordinal()));
OreDictionary.registerOre("unfinishedTank", new ItemStack(FMRecipeLoader.itemParts, 1, Parts.Tank.ordinal()));
}
@ -191,8 +179,6 @@ public class FluidMech extends ModPrefab
FMRecipeLoader.blockPipe = new BlockPipe(getNextID(), "RestrictedPipe");
/* ITEM DECLARATION */
FMRecipeLoader.itemParts = new ItemParts(FluidMech.CONFIGURATION.getItem("Parts", ITEM_ID_PREFIX++).getInt());
FMRecipeLoader.itemGauge = new ItemTools(FluidMech.CONFIGURATION.getItem("PipeGuage", ITEM_ID_PREFIX++).getInt());
CONFIGURATION.save();
}

View file

@ -1,52 +0,0 @@
package dark.fluid.common.item;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.common.FluidMech;
public class ItemBasic extends Item
{
protected final Icon[] icons = new Icon[256];
public ItemBasic(String name, int id)
{
super(id);
this.setUnlocalizedName(name);
this.setCreativeTab(FluidMech.TabFluidMech);
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IconRegister iconRegister)
{
List<ItemStack> list = new ArrayList<ItemStack>();
this.getSubItems(this.itemID, this.getCreativeTab(), list);
if (list.size() < this.icons.length)
{
for (ItemStack itemStack : list)
{
this.icons[list.indexOf(itemStack)] = iconRegister.registerIcon(this.getUnlocalizedName(itemStack).replace("item.", FluidMech.instance.PREFIX));
}
}
}
@SideOnly(Side.CLIENT)
@Override
public Icon getIconFromDamage(int damage)
{
if (this.icons.length > damage && !this.isDamageable())
{
return this.icons[damage];
}
return icons[0];
}
}

View file

@ -1,62 +0,0 @@
package dark.fluid.common.item;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import dark.fluid.common.FluidMech;
/** A metadata item containing parts of various machines in Liquid Mechanics Mod.
*
* @author Rs */
public class ItemParts extends ItemBasic
{
public enum Parts
{
Bronze("BronzeTube"),
Iron("IronTube"),
Obby("ObbyTube"),
Nether("NetherTube"),
Seal("LeatherSeal"),
SlimeSeal("SlimeSeal"),
Tank("UnfinishedTank"),
Valve("ValvePart");
public String name;
private Parts(String name)
{
this.name = name;
}
}
public ItemParts(int par1)
{
super("lmPart", par1);
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setMaxStackSize(64);
this.setCreativeTab(FluidMech.TabFluidMech);
}
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
return "item." + Parts.values()[itemStack.getItemDamage()].name;
}
@Override
public int getMetadata(int meta)
{
return meta;
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int i = 0; i < Parts.values().length; i++)
{
par3List.add(new ItemStack(this, 1, i));
}
}
}

View file

@ -1,77 +0,0 @@
package dark.fluid.common.item;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import dark.api.IToolReadOut;
import dark.api.IToolReadOut.EnumTools;
import dark.fluid.common.FluidMech;
public class ItemTools extends ItemBasic
{
private int spawnID;
public ItemTools(int id)
{
super("lmTool", id);
this.setMaxDamage(0);
this.setHasSubtypes(true);
this.setCreativeTab(FluidMech.TabFluidMech);
this.setMaxStackSize(1);
}
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
int meta = itemStack.getItemDamage();
if (meta == 0)
{
return "item." + "PipeGauge";
}
return "item." + this.getUnlocalizedName() + "." + meta;
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(this, 1, 0));
}
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World par3World, int x, int y, int z, int side, float par8, float par9, float par10)
{
if (!par3World.isRemote)
{
int meta = itemStack.getItemDamage();
TileEntity blockEntity = par3World.getBlockTileEntity(x, y, z);
// pipe Guage
if (meta == 0)
{
if (blockEntity instanceof IToolReadOut)
{
String output = ((IToolReadOut) blockEntity).getMeterReading(player, ForgeDirection.getOrientation(side), EnumTools.PIPE_GUAGE);
if (output.length() > 100)
{
output = output.substring(0, 100);
}
output.trim();
player.sendChatToPlayer(ChatMessageComponent.func_111066_d("ReadOut: " + output));
}
}
else if (meta == 1)
{
}
}
return false;
}
}