OSDN Git Service

変更点をそのままにして修正し、間違っているところを消去&修正
[chemicraft/chemicraft.git] / common / chemicraft / ItemCompounds.java
1 package 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.Entity;
9 import net.minecraft.src.Item;
10 import net.minecraft.src.ItemStack;
11 import net.minecraft.src.World;
12
13 public class ItemCompounds extends Item {
14
15         public ItemCompounds(int par1) {
16                 super(par1);
17                 this.maxStackSize = 1;
18                 this.setHasSubtypes(true);
19                 this.setMaxDamage(0);
20                 this.setCreativeTab(ChemiCraft.instance.creativeTab);
21         }
22
23         @Override
24         public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5){
25                 for(int i=0;i < ChemiCraftAPI.getCompoundsName().size();i++){
26                         for(int j=0;j < ChemiCraftAPI.getCompoundHandlerItemName().size();j++){
27                                 if(ChemiCraftAPI.getCompoundsName().get(i).equals(ChemiCraftAPI.getCompoundHandlerItemName().get(i))){
28                                         ChemiCraftAPI.getCompoundHandler().get(j).onUpdateHandler(par1ItemStack, par2World, par3Entity, par4, par5);
29                                 }
30                         }
31                 }
32         }
33
34         @SideOnly(Side.CLIENT)
35         @Override
36         public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
37         {
38                 for(int type = 0; type < ChemiCraftAPI.getCompoundsName().toArray().length; type++)
39                 {
40                         par3List.add(new ItemStack(par1, 1, type));
41                         this.setIconIndex(type);
42                 }
43         }
44
45         @Override
46         public String getItemNameIS(ItemStack par1ItemStack)
47         {
48                 return super.getItemName() + "." + ChemiCraftAPI.getCompoundsName().toArray()[par1ItemStack.getItemDamage()];
49         }
50
51         @Override
52         public String getTextureFile()
53         {
54                 this.isDefaultTexture = false;
55                 return "/ChemiCraft/items/Compounds.png";
56         }
57
58         @SideOnly(Side.CLIENT)
59         @Override
60         public int getIconFromDamage(int par1)
61         {
62                 return par1;
63         }
64
65 }