1 package chemicraft.item;
3 import net.minecraft.src.EntityPlayer;
4 import net.minecraft.src.ItemStack;
5 import net.minecraft.src.World;
6 import chemicraft.ChemiCraft;
8 public class ItemGasCollectingBottle extends ItemAtomInfoContainer
11 public ItemGasCollectingBottle(int id) {
13 this.setMaxStackSize(1);
15 this.setCreativeTab(ChemiCraft.instance.creativeTab);
19 public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
21 par1ItemStack.damageItem(1, par3EntityPlayer);
23 this.atomInfo.update(par2World, par3EntityPlayer);
25 int heightValue = par2World.getHeightValue((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posZ);
27 int result1 = MathHelperPlus.instance.Probability(99, 1);
28 int result2 = MathHelperPlus.instance.Probability(78, 21, 1);
29 int result3 = MathHelperPlus.instance.Probability(0.032, 0.0018, 0.000012, 0.00052);
30 if (this.atomInfo.isOverY(heightValue)) {
33 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 6), par3EntityPlayer);
34 } else if (result2 == 1) {
35 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 7), par3EntityPlayer);
37 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 17), par3EntityPlayer);
41 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, 0), par3EntityPlayer);
42 } else if (result3 == 1) {
43 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 9), par3EntityPlayer);
44 } else if (result3 == 2) {
45 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, 1), par3EntityPlayer);
47 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 1), par3EntityPlayer);
51 if (par2World.isRemote) {
52 par3EntityPlayer.addChatMessage("result1=" + result1 + " result2=" + result2 + " result3=" + result3);
57 public void isStackOrDrop(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer)
59 if (!par2EntityPlayer.inventory.addItemStackToInventory(par1ItemStack)) {
60 par2EntityPlayer.dropPlayerItem(par1ItemStack);
65 public String getTextureFile()
67 return "/chemicraft/items/items.png";