2013-05-07 01:02:25 +00:00
|
|
|
package biomesoplenty.items;
|
|
|
|
|
2013-05-12 03:13:14 +00:00
|
|
|
import java.util.List;
|
|
|
|
|
2013-05-07 01:02:25 +00:00
|
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
2013-05-12 03:13:14 +00:00
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
2013-05-07 01:02:25 +00:00
|
|
|
import net.minecraft.item.Item;
|
2013-05-12 03:13:14 +00:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.Icon;
|
2013-05-29 01:05:27 +00:00
|
|
|
import biomesoplenty.BiomesOPlenty;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2013-05-07 01:02:25 +00:00
|
|
|
|
|
|
|
public class ItemDart extends Item
|
|
|
|
{
|
2013-05-12 03:13:14 +00:00
|
|
|
private static final String[] dartTypes = new String[] {"dart", "poisondart"};
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
private Icon[] textures;
|
|
|
|
|
2013-05-07 01:02:25 +00:00
|
|
|
public ItemDart(int par1)
|
|
|
|
{
|
|
|
|
super(par1);
|
2013-05-12 03:13:14 +00:00
|
|
|
setHasSubtypes(true);
|
2013-05-07 01:02:25 +00:00
|
|
|
setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
|
|
|
|
}
|
2013-05-12 03:13:14 +00:00
|
|
|
|
2013-05-16 14:26:39 +00:00
|
|
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
2013-05-12 03:13:14 +00:00
|
|
|
@Override
|
|
|
|
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < dartTypes.length; ++i)
|
|
|
|
{
|
|
|
|
par3List.add(new ItemStack(par1, 1, i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getUnlocalizedName(ItemStack itemStack)
|
|
|
|
{
|
2013-05-31 10:34:02 +00:00
|
|
|
int meta = itemStack.getItemDamage();
|
|
|
|
if (meta < 0 || meta >= dartTypes.length) {
|
|
|
|
meta = 0;
|
|
|
|
}
|
|
|
|
|
2013-06-09 08:15:39 +00:00
|
|
|
return super.getUnlocalizedName() + "." + dartTypes[meta];
|
2013-05-12 03:13:14 +00:00
|
|
|
}
|
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
@Override
|
2013-05-12 03:13:14 +00:00
|
|
|
@SideOnly(Side.CLIENT)
|
2013-05-07 01:02:25 +00:00
|
|
|
public void registerIcons(IconRegister iconRegister)
|
|
|
|
{
|
2013-05-12 03:13:14 +00:00
|
|
|
textures = new Icon[dartTypes.length];
|
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
for (int i = 0; i < dartTypes.length; ++i) {
|
2013-07-03 06:01:28 +00:00
|
|
|
textures[i] = iconRegister.registerIcon("biomesoplenty:" + dartTypes[i]);
|
2013-05-31 10:34:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Icon getIconFromDamage(int meta)
|
|
|
|
{
|
|
|
|
return textures[meta];
|
2013-05-07 01:02:25 +00:00
|
|
|
}
|
|
|
|
}
|