1 package pcc.chemicraft.item;
6 import pcc.chemicraft.ChemiCraft;
7 import pcc.chemicraft.ChemiCraftAPI;
10 >>>>>>> a5e4a5c40b9001657f1e36ece533651f63183fbe
11 import net.minecraft.creativetab.CreativeTabs;
12 import net.minecraft.entity.Entity;
13 import net.minecraft.entity.player.EntityPlayer;
14 import net.minecraft.item.Item;
15 import net.minecraft.item.ItemStack;
16 import net.minecraft.world.World;
19 import pcc.chemicraft.ChemiCraft;
20 import pcc.chemicraft.ChemiCraftAPI;
21 >>>>>>> a5e4a5c40b9001657f1e36ece533651f63183fbe
22 import cpw.mods.fml.relauncher.Side;
23 import cpw.mods.fml.relauncher.SideOnly;
25 public class ItemCompounds extends Item {
27 public ItemCompounds(int par1){
29 this.setHasSubtypes(true);
31 this.setCreativeTab(ChemiCraft.instance.creativeTab);
35 public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
37 for(int i=0;i < ChemiCraftAPI.instance().getCompoundHandlerItemName().size();i++){
38 if(ChemiCraftAPI.instance().getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
39 return ChemiCraftAPI.instance().getCompoundHandler().get(i).onItemUseHandler(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
43 for(int i=0;i < ChemiCraftAPI.getInstance().getCompoundHandlerItemName().size();i++){
44 if(ChemiCraftAPI.getInstance().getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.getInstance().getCompoundHandlerItemName().get(i))){
45 return ChemiCraftAPI.getInstance().getCompoundHandler().get(i).onItemUseHandler(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
48 } catch (IndexOutOfBoundsException e) {
49 par1ItemStack.stackSize = 0;
50 >>>>>>> a5e4a5c40b9001657f1e36ece533651f63183fbe
57 public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
60 for(int i=0;i < ChemiCraftAPI.instance().getCompoundHandlerItemName().size();i++){
61 if(ChemiCraftAPI.instance().getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
62 ChemiCraftAPI.instance().getCompoundHandler().get(i).onItemRightClickHandler(par1ItemStack, par2World, par3EntityPlayer);
66 for(int i=0;i < ChemiCraftAPI.getInstance().getCompoundHandlerItemName().size();i++){
67 if(ChemiCraftAPI.getInstance().getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.getInstance().getCompoundHandlerItemName().get(i))){
68 ChemiCraftAPI.getInstance().getCompoundHandler().get(i).onItemRightClickHandler(par1ItemStack, par2World, par3EntityPlayer);
71 } catch (IndexOutOfBoundsException e) {
72 par1ItemStack.stackSize = 0;
73 >>>>>>> a5e4a5c40b9001657f1e36ece533651f63183fbe
81 public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5){
83 for(int i=0;i < ChemiCraftAPI.instance().getCompoundHandlerItemName().size();i++){
84 if(ChemiCraftAPI.instance().getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
85 ChemiCraftAPI.instance().getCompoundHandler().get(i).onUpdateHandler(par1ItemStack, par2World, par3Entity, par4, par5);
89 for(int i=0;i < ChemiCraftAPI.getInstance().getCompoundHandlerItemName().size();i++){
90 if(ChemiCraftAPI.getInstance().getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.getInstance().getCompoundHandlerItemName().get(i))){
91 ChemiCraftAPI.getInstance().getCompoundHandler().get(i).onUpdateHandler(par1ItemStack, par2World, par3Entity, par4, par5);
94 } catch (IndexOutOfBoundsException e) {
95 par1ItemStack.stackSize = 0;
97 >>>>>>> a5e4a5c40b9001657f1e36ece533651f63183fbe
103 @SuppressWarnings({ "unchecked", "rawtypes" })
104 @SideOnly(Side.CLIENT)
106 public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List){
108 for(int type = 0; type < ChemiCraftAPI.instance().getCompoundsName().toArray().length; type++)
110 for(int type = 0; type < ChemiCraftAPI.getInstance().getCompoundsName().toArray().length; type++)
111 >>>>>>> a5e4a5c40b9001657f1e36ece533651f63183fbe
113 par3List.add(new ItemStack(par1, 1, type));
114 this.setIconIndex(type);
121 public String getItemNameIS(ItemStack par1ItemStack){
123 return super.getItemName() + "." + ChemiCraftAPI.instance().getCompoundsName().toArray()[par1ItemStack.getItemDamage()];
126 return super.getItemName() + "." + ChemiCraftAPI.getInstance().getCompoundsName().toArray()[par1ItemStack.getItemDamage()];
127 } catch (ArrayIndexOutOfBoundsException e) {
128 par1ItemStack.stackSize = 0;
131 >>>>>>> a5e4a5c40b9001657f1e36ece533651f63183fbe
137 public String getTextureFile(){
138 return ChemiCraft.instance.ITEMCOMPOUNDSTEXTURE;
143 @SideOnly(Side.CLIENT)
145 public int getIconFromDamage(int par1){
147 for(int i=0;i < ChemiCraftAPI.instance().getCompoundHandlerItemName().size();i++){
148 if(ChemiCraftAPI.instance().getCompoundsName().get(par1).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
149 return ChemiCraftAPI.instance().getCompoundHandler().get(i).getIconIndexHandler();
153 for(int i=0;i < ChemiCraftAPI.getInstance().getCompoundHandlerItemName().size();i++){
154 if(ChemiCraftAPI.getInstance().getCompoundsName().get(par1).equals(ChemiCraftAPI.getInstance().getCompoundHandlerItemName().get(i))){
155 return ChemiCraftAPI.getInstance().getCompoundHandler().get(i).getIconIndexHandler();
158 } catch (IndexOutOfBoundsException e) {
160 >>>>>>> a5e4a5c40b9001657f1e36ece533651f63183fbe