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;
7 import chemicraft.util.MathHelperPlus;
9 public class ItemGasCollectingBottle extends ItemAtomInfoContainer
12 public ItemGasCollectingBottle(int id) {
14 this.setMaxStackSize(1);
16 this.setCreativeTab(ChemiCraft.instance.creativeTab);
20 public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
22 par1ItemStack.damageItem(1, par3EntityPlayer);
24 this.atomInfo.update(par2World, par3EntityPlayer);
26 int heightValue = par2World.getHeightValue((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posZ);
28 int result1 = MathHelperPlus.instance.Probability(99, 1);
29 int result2 = MathHelperPlus.instance.Probability(78, 21, 1);
30 int result3 = MathHelperPlus.instance.Probability(0.032, 0.0018, 0.000012, 0.00052);
31 if (this.atomInfo.isOverY(heightValue)) {
34 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 6), par3EntityPlayer);
35 } else if (result2 == 1) {
36 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 7), par3EntityPlayer);
38 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 17), par3EntityPlayer);
42 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, 0), par3EntityPlayer);
43 } else if (result3 == 1) {
44 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 9), par3EntityPlayer);
45 } else if (result3 == 2) {
46 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, 1), par3EntityPlayer);
48 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 1), par3EntityPlayer);
52 if (par2World.isRemote) {
53 par3EntityPlayer.addChatMessage("result1=" + result1 + " result2=" + result2 + " result3=" + result3);
58 public void isStackOrDrop(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer)
60 if (!par2EntityPlayer.inventory.addItemStackToInventory(par1ItemStack)) {
61 par2EntityPlayer.dropPlayerItem(par1ItemStack);
66 public String getTextureFile()
68 return "/chemicraft/items/items.png";