OSDN Git Service

ts
[chemicraft/chemicraft.git] / src / ItemCompounds.java
1 package net.minecraft.src.ChemiCraft;
2
3 import java.util.List;
4
5 import cpw.mods.fml.common.Side;
6 import cpw.mods.fml.common.asm.SideOnly;
7 import net.minecraft.src.CreativeTabs;
8 import net.minecraft.src.Item;
9 import net.minecraft.src.ItemStack;
10
11 public class ItemCompounds extends Item {
12
13         public ItemCompounds(int par1) {
14                 super(par1);
15                 this.maxStackSize = 1;
16                 this.setHasSubtypes(true);
17                 this.setMaxDamage(0);
18                 this.setCreativeTab(CreativeTabs.tabMaterials);
19         }
20
21         @SideOnly(Side.CLIENT)
22         @Override
23         public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
24         {
25                 for(int type = 0; type < ChemiCraftAPI.getCompoundsName().toArray().length; type++)
26                 {
27                         par3List.add(new ItemStack(par1, 1, type));
28                         this.setIconIndex(type);
29                 }
30         }
31
32         @Override
33         public String getItemNameIS(ItemStack par1ItemStack)
34         {
35                 return super.getItemName() + "." + ChemiCraftAPI.getCompoundsName().toArray()[par1ItemStack.getItemDamage()];
36         }
37
38         @Override
39         public String getTextureFile()
40         {
41                 this.isDefaultTexture = false;
42                 return "/ChemiCraft/Compounds.png";
43         }
44
45         @SideOnly(Side.CLIENT)
46         @Override
47         public int getIconFromDamage(int par1)
48         {
49                 return par1;
50         }
51
52 }