OSDN Git Service

適当にコミット
[chemicraft/chemicraft.git] / common / chemicraft / item / ItemGasCollectingBottle.java
1 package chemicraft.item;
2
3 import net.minecraft.src.EntityPlayer;
4 import net.minecraft.src.ItemStack;
5 import net.minecraft.src.World;
6 import chemicraft.ChemiCraft;
7
8 public class ItemGasCollectingBottle extends ItemAtomInfoContainer {
9
10         public ItemGasCollectingBottle(int id) {
11                 super(id);
12                 this.setMaxStackSize(1);
13                 this.setMaxDamage(2);
14                 this.setCreativeTab(ChemiCraft.instance.creativeTab);
15         }
16
17         @Override
18         public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
19                 par1ItemStack.damageItem(1, par3EntityPlayer);
20
21                 this.atomInfo.update(par2World, par3EntityPlayer);
22                 if(this.atomInfo.isBelowY(129)){
23             if (!par3EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 7)))
24             {
25                 par3EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 7));
26             }
27                 }
28
29                 return par1ItemStack;
30         }
31
32         @Override
33         public String getTextureFile() {
34                 return "/chemicraft/items/items.png";
35         }
36
37 }