1 package chemicraft.item;
5 import net.minecraft.src.CreativeTabs;
6 import net.minecraft.src.Entity;
7 import net.minecraft.src.EntityPlayer;
8 import net.minecraft.src.Item;
9 import net.minecraft.src.ItemStack;
10 import net.minecraft.src.World;
11 import chemicraft.ChemiCraft;
12 import chemicraft.ChemiCraftAPI;
13 import cpw.mods.fml.common.Side;
14 import cpw.mods.fml.common.asm.SideOnly;
16 public class ItemCompounds extends Item {
18 public ItemCompounds(int par1){
20 this.maxStackSize = 1;
21 this.setHasSubtypes(true);
23 this.setCreativeTab(ChemiCraft.instance.creativeTab);
27 public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
28 for(int i=0;i < ChemiCraftAPI.instance.getCompoundHandlerItemName().size();i++){
29 if(ChemiCraftAPI.instance.getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance.getCompoundHandlerItemName().get(i))){
30 return ChemiCraftAPI.instance.getCompoundHandler().get(i).onItemUseHandler(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
38 public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
40 for(int i=0;i < ChemiCraftAPI.instance.getCompoundHandlerItemName().size();i++){
41 if(ChemiCraftAPI.instance.getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance.getCompoundHandlerItemName().get(i))){
42 ChemiCraftAPI.instance.getCompoundHandler().get(i).onItemRightClickHandler(par1ItemStack, par2World, par3EntityPlayer);
51 public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5){
52 for(int i=0;i < ChemiCraftAPI.instance.getCompoundHandlerItemName().size();i++){
53 if(ChemiCraftAPI.instance.getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance.getCompoundHandlerItemName().get(i))){
54 ChemiCraftAPI.instance.getCompoundHandler().get(i).onUpdateHandler(par1ItemStack, par2World, par3Entity, par4, par5);
61 @SideOnly(Side.CLIENT)
63 public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List){
64 for(int type = 0; type < ChemiCraftAPI.instance.getCompoundsName().toArray().length; type++)
66 par3List.add(new ItemStack(par1, 1, type));
67 this.setIconIndex(type);
74 public String getItemNameIS(ItemStack par1ItemStack){
75 return super.getItemName() + "." + ChemiCraftAPI.instance.getCompoundsName().toArray()[par1ItemStack.getItemDamage()];
81 public String getTextureFile(){
82 return ChemiCraft.instance.itemCompoundsTexture;
87 @SideOnly(Side.CLIENT)
89 public int getIconFromDamage(int par1){
90 for(int i=0;i < ChemiCraftAPI.instance.getCompoundHandlerItemName().size();i++){
91 if(ChemiCraftAPI.instance.getCompoundsName().get(par1).equals(ChemiCraftAPI.instance.getCompoundHandlerItemName().get(i))){
92 return ChemiCraftAPI.instance.getCompoundHandler().get(i).getIconIndexHandler();