package micdoodle8.mods.galacticraft.planets.asteroids.items;
import micdoodle8.mods.galacticraft.core.GalacticraftCore;
import micdoodle8.mods.galacticraft.core.items.ISortableItem;
import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore;
import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem;
import micdoodle8.mods.galacticraft.core.util.GCCoreUtil;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
public class ItemBasicAsteroids extends Item implements ISortableItem
{
public static String[] names = { "ingot_titanium", "engine_t2", "rocket_fins_t2", "shard_iron", "shard_titanium", "reinforced_plate_t3", "compressed_titanium", "thermal_cloth", "beam_core" };
// protected IIcon[] icons = new IIcon[ItemBasicAsteroids.names.length];
public ItemBasicAsteroids(String name)
{
super();
this.setMaxDamage(0);
this.setHasSubtypes(true);
this.setUnlocalizedName(name);
}
@SideOnly(Side.CLIENT)
@Override
public CreativeTabs getCreativeTab()
{
return GalacticraftCore.galacticraftItemsTab;
}
@Override
@SideOnly(Side.CLIENT)
public EnumRarity getRarity(ItemStack par1ItemStack)
{
return ClientProxyCore.galacticraftItem;
}
/*@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
int i = 0;
for (String name : ItemBasicAsteroids.names)
{
this.icons[i++] = iconRegister.registerIcon(GalacticraftPlanets.TEXTURE_PREFIX + name);
}
}
@Override
public IIcon getIconFromDamage(int damage)
{
if (this.icons.length > damage)
{
return this.icons[damage];
}
return super.getIconFromDamage(damage);
}*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int i = 0; i < ItemBasicAsteroids.names.length; i++)
{
par3List.add(new ItemStack(par1, 1, i));
}
}
@Override
public String getUnlocalizedName(ItemStack par1ItemStack)
{
if (ItemBasicAsteroids.names.length > par1ItemStack.getItemDamage())
{
return "item." + ItemBasicAsteroids.names[par1ItemStack.getItemDamage()];
}
return "unnamed";
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List<String> tooltip, boolean par4)
{
if (par1ItemStack != null && par1ItemStack.getItemDamage() == 5)
{
tooltip.add(GCCoreUtil.translate("item.tier3.desc"));
}
}
@Override
public int getMetadata(int par1)
{
return par1;
}
@Override
public EnumSortCategoryItem getCategory(int meta)
{
switch (meta)
{
case 0:
return EnumSortCategoryItem.INGOT;
case 5:
case 6:
return EnumSortCategoryItem.PLATE;
}
return EnumSortCategoryItem.GENERAL;
}
}