package techreborn.items;

import java.util.List;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import techreborn.client.TechRebornCreativeTabMisc;

public class ItemIngots extends Item {
	public static final String[] types = new String[]
	{ "IridiumAlloy", "HotTungstenSteel", "TungstenSteel", "Iridium", "Silver",
			"Aluminium", "Titanium", "Chrome", "Electrum", "Tungsten", "Lead",
			"Zinc", "Brass", "Steel", "Platinum", "Nickel", "Invar", "Cobalt",
			"Ardite", "Manyullyn", "AlBrass", "Alumite" };

	private IIcon[] textures;

	public ItemIngots()
	{
		setCreativeTab(TechRebornCreativeTabMisc.instance);
		setHasSubtypes(true);
		setUnlocalizedName("techreborn.ingot");
	}

	@Override
	// Registers Textures For All Dusts
	public void registerIcons(IIconRegister iconRegister)
	{
		textures = new IIcon[types.length];

		for (int i = 0; i < types.length; ++i)
		{
			textures[i] = iconRegister.registerIcon("techreborn:" + "ingot/"
					+ types[i] + "Ingot");
		}
	}

	@Override
	// Adds Texture what match's meta data
	public IIcon getIconFromDamage(int meta)
	{
		if (meta < 0 || meta >= textures.length)
		{
			meta = 0;
		}

		return textures[meta];
	}

	@Override
	// gets Unlocalized Name depending on meta data
	public String getUnlocalizedName(ItemStack itemStack)
	{
		int meta = itemStack.getItemDamage();
		if (meta < 0 || meta >= types.length)
		{
			meta = 0;
		}

		return super.getUnlocalizedName() + "." + types[meta];
	}

	// Adds Dusts SubItems To Creative Tab
	public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
	{
		for (int meta = 0; meta < types.length; ++meta)
		{
			list.add(new ItemStack(item, 1, meta));
		}
	}

	@Override
	public EnumRarity getRarity(ItemStack itemstack)
	{
		return EnumRarity.uncommon;
	}

}

@@ -438,17 +438,17 @@
 g%5B%5D%0A%09%7B %22
-I
+i
 ridiumAl
@@ -454,17 +454,17 @@
 lloy%22, %22
-H
+h
 otTungst
@@ -470,25 +470,25 @@
 tenSteel%22, %22
-T
+t
 ungstenSteel
@@ -491,17 +491,17 @@
 teel%22, %22
-I
+i
 ridium%22,
@@ -502,17 +502,17 @@
 dium%22, %22
-S
+s
 ilver%22,%0A
@@ -515,17 +515,17 @@
 r%22,%0A%09%09%09%22
-A
+a
 luminium
@@ -528,17 +528,17 @@
 nium%22, %22
-T
+t
 itanium%22
@@ -540,17 +540,17 @@
 nium%22, %22
-C
+c
 hrome%22, 
@@ -550,17 +550,17 @@
 rome%22, %22
-E
+e
 lectrum%22
@@ -562,17 +562,17 @@
 trum%22, %22
-T
+t
 ungsten%22
@@ -574,17 +574,17 @@
 sten%22, %22
-L
+l
 ead%22,%0A%09%09
@@ -589,25 +589,25 @@
 %09%09%09%22
-Z
+z
 inc%22, %22
-B
+b
 rass%22, %22
 Stee
@@ -602,25 +602,25 @@
 rass%22, %22
-S
+s
 teel%22, %22
 Platinum
@@ -615,9 +615,9 @@
 %22, %22
-P
+p
 lati
@@ -623,17 +623,17 @@
 inum%22, %22
-N
+n
 ickel%22, 
@@ -637,17 +637,17 @@
 %22, %22
-I
+i
 nvar%22, %22
 Coba
@@ -642,17 +642,17 @@
 nvar%22, %22
-C
+c
 obalt%22,%0A
@@ -655,17 +655,17 @@
 t%22,%0A%09%09%09%22
-A
+a
 rdite%22, 
@@ -665,17 +665,17 @@
 dite%22, %22
-M
+m
 anyullyn
@@ -678,17 +678,17 @@
 llyn%22, %22
-A
+a
 lBrass%22,
@@ -689,17 +689,17 @@
 rass%22, %22
-A
+a
 lumite%22 

test fix for no textures on ingots