3 import java.util.Random;
5 import net.minecraft.src.*;
7 public class ItemGasCollectingBottle extends ItemAtomInfoContainer
10 public ItemGasCollectingBottle(int id) {
12 this.setMaxStackSize(1);
14 this.setCreativeTab(ChemiCraft.instance.creativeTab);
18 public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
20 par1ItemStack.damageItem(1, par3EntityPlayer);
22 this.atomInfo.update(par2World, par3EntityPlayer);
24 int heightValue = par2World.getHeightValue((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posZ);
26 int result1 = MathHelperPlus.instance.Probability(99, 1);
27 int result2 = MathHelperPlus.instance.Probability(78, 21, 1);
28 int result3 = MathHelperPlus.instance.Probability(0.032, 0.0018, 0.000012, 0.00052);
29 if (this.atomInfo.isOverY(heightValue)) {
32 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 6), par3EntityPlayer);
33 } else if (result2 == 1) {
34 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 7), par3EntityPlayer);
36 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 17), par3EntityPlayer);
40 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, 0), par3EntityPlayer);
41 } else if (result3 == 1) {
42 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 9), par3EntityPlayer);
43 } else if (result3 == 2) {
44 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, 1), par3EntityPlayer);
46 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 1), par3EntityPlayer);
50 if (par2World.isRemote) {
51 par3EntityPlayer.addChatMessage("result1=" + result1 + " result2=" + result2 + " result3=" + result3);
56 public void isStackOrDrop(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer)
58 if (!par2EntityPlayer.inventory.addItemStackToInventory(par1ItemStack)) {
59 par2EntityPlayer.dropPlayerItem(par1ItemStack);
64 public String getTextureFile()
66 return "/chemicraft/items/items.png";