OSDN Git Service

GUIのSlot追加
[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
24
25         @Override
26         public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5){
27                 for(int i=0;i < ChemiCraftAPI.getCompoundsName().size();i++){
28                         for(int j=0;j < ChemiCraftAPI.getCompoundHandlerItemName().size();j++){
29                                 if(ChemiCraftAPI.getCompoundsName().get(i).equals(ChemiCraftAPI.getCompoundHandlerItemName().get(i))){
30                                         ChemiCraftAPI.getCompoundHandler().get(j).onUpdateHandler(par1ItemStack, par2World, par3Entity, par4, par5);
31                                 }
32                         }
33                 }
34         }
35
36
37
38         @SideOnly(Side.CLIENT)
39         @Override
40         public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List){
41                 for(int type = 0; type < ChemiCraftAPI.getCompoundsName().toArray().length; type++)
42                 {
43                         par3List.add(new ItemStack(par1, 1, type));
44                         this.setIconIndex(type);
45                 }
46         }
47
48
49
50         @Override
51         public String getItemNameIS(ItemStack par1ItemStack){
52                 return super.getItemName() + "." + ChemiCraftAPI.getCompoundsName().toArray()[par1ItemStack.getItemDamage()];
53         }
54
55
56
57         @Override
58         public String getTextureFile(){
59                 return ChemiCraft.instance.itemCompoundsTexture;
60         }
61
62
63
64         @SideOnly(Side.CLIENT)
65         @Override
66         public int getIconFromDamage(int par1){
67                 return par1;
68         }
69
70 }