1 package chemicraft.item;
3 import net.minecraft.block.Block;
4 import net.minecraft.block.BlockFire;
5 import net.minecraft.entity.player.EntityPlayer;
6 import net.minecraft.item.ItemStack;
7 import net.minecraft.world.World;
8 import chemicraft.ChemiCraft;
9 import chemicraft.ChemiCraftAPI;
10 import chemicraft.util.MathHelperPlus;
12 public class ItemGasCollectingBottle extends ItemAtomInfoContainer
15 public ItemGasCollectingBottle(int id) {
17 this.setMaxStackSize(1);
19 this.setCreativeTab(ChemiCraft.instance.creativeTab);
23 public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
25 par1ItemStack.damageItem(1, par3EntityPlayer);
27 this.atomInfo.update(par2World, par3EntityPlayer);
29 int heightValue = par2World.getHeightValue((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posZ);
31 int result1 = MathHelperPlus.probability(99, 1);
32 int result2 = MathHelperPlus.probability(78, 21, 1);
33 int result3 = MathHelperPlus.probability(0.032, 0.0018, 0.000012, 0.00052);
34 if (this.atomInfo.isOverY(heightValue)) {
37 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 6), par3EntityPlayer);
38 } else if (result2 == 1) {
39 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 7), par3EntityPlayer);
41 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 17), par3EntityPlayer);
45 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.getInstance().getCompound("CarbonDioxide")), par3EntityPlayer);
46 } else if (result3 == 1) {
47 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 9), par3EntityPlayer);
48 } else if (result3 == 2) {
49 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, 1), par3EntityPlayer);
51 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 1), par3EntityPlayer);
57 if (par2World.isRemote) {
58 par3EntityPlayer.addChatMessage("result1=" + result1 + " result2=" + result2 + " result3=" + result3);
59 par3EntityPlayer.addChatMessage("このメッセージは開発版のみの表示ですが、もし製品版で表示されていた場合はご連絡ください。");
65 protected void isStackOrDrop(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer)
67 if (!par2EntityPlayer.inventory.addItemStackToInventory(par1ItemStack)) {
68 par2EntityPlayer.dropPlayerItem(par1ItemStack);
73 public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
75 int blockID = par3World.getBlockId(par4, par5, par6);
76 Block block = Block.blocksList[blockID];
78 int uniqueBlockID = par3World.getBlockId(par4, par5 + 1, par6);
79 Block uniqueBlock = Block.blocksList[uniqueBlockID];
81 if (uniqueBlock instanceof BlockFire){
82 par1ItemStack.damageItem(1, par2EntityPlayer);
84 int result1 = MathHelperPlus.probability(90, 10);
87 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.getInstance().getCompound("CarbonDioxide")), par2EntityPlayer);
89 this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.getInstance().getCompound("CarbonMonoxide")), par2EntityPlayer);
98 public String getTextureFile()
100 return "/chemicraft/items/items.png";