OSDN Git Service

適当にコミット
[chemicraft/chemicraft.git] / common / chemicraft / item / ItemCompounds.java
index 3dc1d64..e9112e7 100644 (file)
@@ -4,6 +4,7 @@ import java.util.List;
 
 import net.minecraft.src.CreativeTabs;
 import net.minecraft.src.Entity;
 
 import net.minecraft.src.CreativeTabs;
 import net.minecraft.src.Entity;
+import net.minecraft.src.EntityPlayer;
 import net.minecraft.src.Item;
 import net.minecraft.src.ItemStack;
 import net.minecraft.src.World;
 import net.minecraft.src.Item;
 import net.minecraft.src.ItemStack;
 import net.minecraft.src.World;
@@ -22,15 +23,35 @@ public class ItemCompounds extends Item {
                this.setCreativeTab(ChemiCraft.instance.creativeTab);
        }
 
                this.setCreativeTab(ChemiCraft.instance.creativeTab);
        }
 
+       @Override
+       public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
+               for(int i=0;i < ChemiCraftAPI.instance.getCompoundHandlerItemName().size();i++){
+                       if(ChemiCraftAPI.instance.getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance.getCompoundHandlerItemName().get(i))){
+                               return ChemiCraftAPI.instance.getCompoundHandler().get(i).onItemUseHandler(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
+                       }
+               }
+               return false;
+       }
+
+
+       @Override
+       public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
+       {
+               for(int i=0;i < ChemiCraftAPI.instance.getCompoundHandlerItemName().size();i++){
+                       if(ChemiCraftAPI.instance.getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance.getCompoundHandlerItemName().get(i))){
+                               ChemiCraftAPI.instance.getCompoundHandler().get(i).onItemRightClickHandler(par1ItemStack, par2World, par3EntityPlayer);
+                       }
+               }
+               return par1ItemStack;
+       }
+
 
 
        @Override
        public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5){
 
 
        @Override
        public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5){
-               for(int i=0;i < ChemiCraftAPI.instance.getCompoundsName().size();i++){
-                       for(int j=0;j < ChemiCraftAPI.instance.getCompoundHandlerItemName().size();j++){
-                               if(ChemiCraftAPI.instance.getCompoundsName().get(i).equals(ChemiCraftAPI.instance.getCompoundHandlerItemName().get(i))){
-                                       ChemiCraftAPI.instance.getCompoundHandler().get(j).onUpdateHandler(par1ItemStack, par2World, par3Entity, par4, par5);
-                               }
+               for(int i=0;i < ChemiCraftAPI.instance.getCompoundHandlerItemName().size();i++){
+                       if(ChemiCraftAPI.instance.getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance.getCompoundHandlerItemName().get(i))){
+                               ChemiCraftAPI.instance.getCompoundHandler().get(i).onUpdateHandler(par1ItemStack, par2World, par3Entity, par4, par5);
                        }
                }
        }
                        }
                }
        }
@@ -66,7 +87,12 @@ public class ItemCompounds extends Item {
        @SideOnly(Side.CLIENT)
        @Override
        public int getIconFromDamage(int par1){
        @SideOnly(Side.CLIENT)
        @Override
        public int getIconFromDamage(int par1){
-               return par1;
+               for(int i=0;i < ChemiCraftAPI.instance.getCompoundHandlerItemName().size();i++){
+                       if(ChemiCraftAPI.instance.getCompoundsName().get(par1).equals(ChemiCraftAPI.instance.getCompoundHandlerItemName().get(i))){
+                               return ChemiCraftAPI.instance.getCompoundHandler().get(i).getIconIndexHandler();
+                       }
+               }
+               return 0;
        }
 
 }
        }
 
 }